build(ci): make dependency review works on PRs
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 7 Sep 2023 13:26:17 +0000 (15:26 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 7 Sep 2023 13:26:17 +0000 (15:26 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.github/workflows/ci.yml

index 9ec012252124ee46a028c88024581cefde3a815d..a5bfe298373ae4e1a2337adf707c8eee120fb068 100644 (file)
@@ -19,11 +19,14 @@ jobs:
         with:
           fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
       - name: 'Dependency Review'
-        if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
+        if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
         uses: actions/dependency-review-action@v3
         with:
-          base-ref: main
+          base-ref: ${{ github.ref_name }}
           head-ref: ${{ github.sha }}
+      - name: 'Pull Request Dependency Review'
+        if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
+        uses: actions/dependency-review-action@v3
       - uses: pnpm/action-setup@v2
         with:
           version: 8
@@ -65,11 +68,14 @@ jobs:
         with:
           fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
       - name: 'Dependency Review'
-        if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
+        if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
         uses: actions/dependency-review-action@v3
         with:
-          base-ref: main
+          base-ref: ${{ github.ref_name }}
           head-ref: ${{ github.sha }}
+      - name: 'Pull Request Dependency Review'
+        if: ${{ github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x' }}
+        uses: actions/dependency-review-action@v3
       - uses: pnpm/action-setup@v2
         with:
           version: 8