Skip to content

Commit

Permalink
feat: better scan log output on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
pgurusinga committed Nov 22, 2024
1 parent e06f0dc commit 0105885
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ jobs:
- name: Check trivy results
run: |
if grep -qE 'HIGH|CRITICAL' trivy-results.sarif; then
echo "Vulnerabilities found"
echo "Vulnerabilities found:"
jq -r '
.runs[].results[] |
"Rule ID: \(.ruleId)\n" +
"Package: \(.message.text | split("\n")[0] | ltrimstr("Package: "))\n" +
"Installed Version: \(.message.text | split("\n")[1] | ltrimstr("Installed Version: "))\n" +
"Severity: \(.message.text | split("\n")[2] | ltrimstr("Severity: "))\n" +
"\(.message.text | split("\n")[4] | ltrimstr("Link: "))\n"
' trivy-results.sarif
# Exit with error status
exit 1
else
echo "No significant vulnerabilities found"
Expand Down

0 comments on commit 0105885

Please sign in to comment.