Skip to content

Commit 73bb4a0

Browse files
committed
fix(ci): only upload Trivy SARIF when scan succeeds
1 parent 51e2f87 commit 73bb4a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/images.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
sbom: true
7070

7171
- name: Run Trivy vulnerability scanner
72+
id: trivy
7273
uses: aquasecurity/trivy-action@master
7374
with:
7475
image-ref: ghcr.io/${{ github.repository_owner }}/flowsint-app:${{ github.ref_name }}
@@ -78,7 +79,7 @@ jobs:
7879

7980
- name: Upload Trivy scan results
8081
uses: github/codeql-action/upload-sarif@v3
81-
if: always()
82+
if: always() && steps.trivy.outcome == 'success'
8283
with:
8384
sarif_file: "trivy-frontend.sarif"
8485

@@ -142,6 +143,7 @@ jobs:
142143
sbom: true
143144

144145
- name: Run Trivy vulnerability scanner
146+
id: trivy
145147
uses: aquasecurity/trivy-action@master
146148
with:
147149
image-ref: ghcr.io/${{ github.repository_owner }}/flowsint-api:${{ github.ref_name }}
@@ -151,7 +153,7 @@ jobs:
151153

152154
- name: Upload Trivy scan results
153155
uses: github/codeql-action/upload-sarif@v3
154-
if: always()
156+
if: always() && steps.trivy.outcome == 'success'
155157
with:
156158
sarif_file: "trivy-backend.sarif"
157159

0 commit comments

Comments
 (0)