File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,28 +44,23 @@ jobs:
4444 uses : aquasecurity/trivy-action@master
4545 with :
4646 image-ref : " ${{ env.IMAGE }}:${{ inputs.image_tag || 'latest' }}"
47- format : " json"
48- output : " trivy-results.json"
49- severity : " CRITICAL,HIGH,MEDIUM"
50- # Only report vulns that have a fix available
51- ignore-unfixed : true
47+ format : " table"
48+ output : " trivy-results.txt"
5249 trivy-config : trivy.yaml
53-
50+
5451 - name : Check for vulnerabilities
5552 id : check
5653 run : |
57- VULN_COUNT=$(jq '[.Results[]?.Vulnerabilities // [] | .[] | select(.FixedVersion != null and .FixedVersion != "")] | length' trivy-results.json)
58- echo "Found $VULN_COUNT fixable vulnerabilities"
59- if [ "$VULN_COUNT" -gt 0 ]; then
54+ if [ -s trivy-results.txt ] && grep -qE "Total: [1-9]" trivy-results.txt; then
6055 echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
6156 else
6257 echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
6358 fi
64-
59+
6560 - name : Upload scan results
6661 if : steps.check.outputs.has_vulnerabilities == 'true'
6762 uses : actions/upload-artifact@v4
6863 with :
6964 name : trivy-results
70- path : trivy-results.json
65+ path : trivy-results.txt
7166 retention-days : 30
Original file line number Diff line number Diff line change 77 pkg-types :
88 - os
99 - library
10+
11+ severity :
12+ - CRITICAL
13+ - HIGH
14+ - MEDIUM
15+
16+ vulnerability :
17+ ignore-unfixed : true
You can’t perform that action at this time.
0 commit comments