Skip to content

Commit

Permalink
Fix govluncheck sarif upload (#6086)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
Jim Ryan and jjngx authored Jul 29, 2024
1 parent 22206e1 commit fc0904a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/image-promotion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,18 @@ jobs:
output-format: sarif
output-file: govulncheck.sarif

- name: Check SARIF file
id: check-sarif
run: |
if [ -s govulncheck.sarif ] && grep -q '"results":' govulncheck.sarif; then
echo "sarif_has_results=true" >> $GITHUB_OUTPUT
else
echo "sarif_has_results=false" >> $GITHUB_OUTPUT
fi
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14
if: steps.check-sarif.outputs.sarif_has_results == 'true'
with:
sarif_file: govulncheck.sarif

Expand Down

0 comments on commit fc0904a

Please sign in to comment.