@@ -20,36 +20,26 @@ jobs:
20
20
outputs :
21
21
has_vulnerabilities : ${{ steps.scan.outputs.has_vulnerabilities || inputs.force_build }}
22
22
steps :
23
- # Pretty output for logs
24
- - id : scan-table
23
+ # Single scan for both vulnerabilities and dependencies
24
+ - id : scan
25
25
if : inputs.skip_scan != true
26
26
uses : aquasecurity/trivy-action@0.29.0
27
27
with :
28
28
image-ref : ' ghcr.io/serversideup/docker-ssh'
29
+ format : ' github'
30
+ output : ' trivy-results.json'
31
+ github-pat : ${{ secrets.GITHUB_TOKEN }}
29
32
ignore-unfixed : true
30
33
severity : ' CRITICAL,HIGH'
31
34
hide-progress : true
32
- format : ' table' # Human readable output
33
-
34
- # JSON scan for parsing
35
- - id : scan-json
36
- if : inputs.skip_scan != true
37
- uses : aquasecurity/trivy-action@0.29.0
38
- with :
39
- image-ref : ' ghcr.io/serversideup/docker-ssh'
40
- ignore-unfixed : true
41
- severity : ' CRITICAL,HIGH'
42
- hide-progress : true
43
- format : ' json'
44
- output : ' trivy-results.json' # Explicitly specify output file
45
35
46
- # Parse Trivy results to set has_vulnerabilities
36
+ # Parse results to set has_vulnerabilities (for workflow control)
47
37
- if : inputs.skip_scan != true
48
38
id : parse
49
39
shell : bash
50
40
run : |
51
41
if [ -f trivy-results.json ]; then
52
- VULN_COUNT=$(jq -r '[ .Results[] | select(.Vulnerabilities != null) | .Vulnerabilities[] ] | length // 0' trivy-results.json)
42
+ VULN_COUNT=$(jq -r '.vulnerabilities | length // 0' trivy-results.json)
53
43
if [ "${VULN_COUNT:-0}" -gt 0 ]; then
54
44
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
55
45
else
0 commit comments