Skip to content

Commit e3c2093

Browse files
committed
Use GitHub format
1 parent 1f0b414 commit e3c2093

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

.github/workflows/action_publish-images-security-updates.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,26 @@ jobs:
2020
outputs:
2121
has_vulnerabilities: ${{ steps.scan.outputs.has_vulnerabilities || inputs.force_build }}
2222
steps:
23-
# Pretty output for logs
24-
- id: scan-table
23+
# Single scan for both vulnerabilities and dependencies
24+
- id: scan
2525
if: inputs.skip_scan != true
2626
uses: aquasecurity/trivy-action@0.29.0
2727
with:
2828
image-ref: 'ghcr.io/serversideup/docker-ssh'
29+
format: 'github'
30+
output: 'trivy-results.json'
31+
github-pat: ${{ secrets.GITHUB_TOKEN }}
2932
ignore-unfixed: true
3033
severity: 'CRITICAL,HIGH'
3134
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
4535

46-
# Parse Trivy results to set has_vulnerabilities
36+
# Parse results to set has_vulnerabilities (for workflow control)
4737
- if: inputs.skip_scan != true
4838
id: parse
4939
shell: bash
5040
run: |
5141
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)
5343
if [ "${VULN_COUNT:-0}" -gt 0 ]; then
5444
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
5545
else

0 commit comments

Comments
 (0)