File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,25 @@ jobs:
40
40
ignore-unfixed : true
41
41
severity : ' CRITICAL,HIGH'
42
42
hide-progress : true
43
- format : ' json' # For parsing
43
+ format : ' json'
44
+ output : ' trivy-results.json' # Explicitly specify output file
44
45
45
46
# Parse Trivy results to set has_vulnerabilities
46
47
- if : inputs.skip_scan != true
47
48
id : parse
49
+ shell : bash
48
50
run : |
49
- VULN_COUNT=$(cat trivy-results.json | jq '[.Results[] | select(.Vulnerabilities != null) | .Vulnerabilities[]] | length')
50
- if [ "$VULN_COUNT" -gt 0 ]; then
51
- echo "has_vulnerabilities=true" >> $GITHUB_OUTPUT
51
+ if [ -f trivy-results.json ]; then
52
+ VULN_COUNT=$(jq -r '[ .Results[] | select(.Vulnerabilities != null) | .Vulnerabilities[] ] | length // 0' trivy-results.json)
53
+ if [ "${VULN_COUNT:-0}" -gt 0 ]; then
54
+ echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
55
+ else
56
+ echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
57
+ fi
52
58
else
53
- echo "has_vulnerabilities=false" >> $GITHUB_OUTPUT
59
+ echo "Error: trivy-results.json not found"
60
+ echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
61
+ exit 1
54
62
fi
55
63
56
64
get-latest-release :
You can’t perform that action at this time.
0 commit comments