Skip to content

Commit fc0904a

Browse files
Jim Ryanjjngx
andauthored
Fix govluncheck sarif upload (#6086)
* test if govulncheck will fail on sarif upload, if there is no issue * test if it will skip if there is a results key in the json * check if sarif file has results in image promotion workflow --------- Co-authored-by: Jakub Jarosz <[email protected]>
1 parent 22206e1 commit fc0904a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/image-promotion.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,18 @@ jobs:
133133
output-format: sarif
134134
output-file: govulncheck.sarif
135135

136+
- name: Check SARIF file
137+
id: check-sarif
138+
run: |
139+
if [ -s govulncheck.sarif ] && grep -q '"results":' govulncheck.sarif; then
140+
echo "sarif_has_results=true" >> $GITHUB_OUTPUT
141+
else
142+
echo "sarif_has_results=false" >> $GITHUB_OUTPUT
143+
fi
144+
136145
- name: Upload SARIF file
137146
uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14
147+
if: steps.check-sarif.outputs.sarif_has_results == 'true'
138148
with:
139149
sarif_file: govulncheck.sarif
140150

0 commit comments

Comments
 (0)