File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 35
35
ignore-unfixed : true
36
36
severity : ' CRITICAL,HIGH'
37
37
hide-progress : true
38
-
39
- - name : Upload trivy report as a Github artifact
40
- uses : actions/upload-artifact@v4
41
- with :
42
- name : trivy-sbom-report
43
- path : ' ${{ github.workspace }}/trivy-results.json'
44
- retention-days : 20
45
38
46
39
# Parse results to set has_vulnerabilities (for workflow control)
47
40
- if : inputs.skip_scan != true
@@ -52,12 +45,23 @@ jobs:
52
45
VULN_COUNT=$(jq -r '.vulnerabilities | length // 0' trivy-results.json)
53
46
if [ "${VULN_COUNT:-0}" -gt 0 ]; then
54
47
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
48
+
49
+ # Create native GitHub annotations for vulnerabilities
50
+ echo "# Security Vulnerabilities Found" >> $GITHUB_STEP_SUMMARY
51
+ echo "| Severity | Package | Installed Version | Vulnerability ID | Description |" >> $GITHUB_STEP_SUMMARY
52
+ echo "|----------|---------|-------------------|------------------|-------------|" >> $GITHUB_STEP_SUMMARY
53
+
54
+ jq -r '.vulnerabilities[] | "| \(.severity) | \(.pkgName) | \(.installedVersion) | \(.vulnerabilityID) | \(.title) |"' trivy-results.json >> $GITHUB_STEP_SUMMARY
55
+
56
+ echo "::notice::Found ${VULN_COUNT} security vulnerabilities that need to be addressed."
55
57
else
56
58
echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
59
+ echo "No vulnerabilities found." >> $GITHUB_STEP_SUMMARY
57
60
fi
58
61
else
59
62
echo "Error: trivy-results.json not found"
60
63
echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
64
+ echo "::error::trivy-results.json not found"
61
65
exit 1
62
66
fi
63
67
You can’t perform that action at this time.
0 commit comments