File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+ ---
3+ name : ' Trivy Cache Update'
4+ description : ' Composite action to run download the trivy cache'
5+
6+ # See https://github.com/aquasecurity/trivy-action#updating-caches-in-the-default-branch
7+ runs :
8+ using : " composite"
9+ steps :
10+ - name : Checkout tools repo
11+ uses : actions/checkout@v4
12+ with :
13+ repository : Consensys/docs-gha
14+ path : .docs-gha
15+
16+ - name : Get current date
17+ id : date
18+ shell : sh
19+ run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
20+
21+ # May need to use https://github.com/marketplace/actions/retry-step to retry
22+ - name : Download and extract the vulnerability DB
23+ shell : sh
24+ run : |
25+ mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db
26+ oras pull ghcr.io/aquasecurity/trivy-db:2
27+ tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db
28+ rm db.tar.gz
29+
30+ - name : Download and extract the Java DB
31+ shell : sh
32+ run : |
33+ mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db
34+ oras pull ghcr.io/aquasecurity/trivy-java-db:1
35+ tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db
36+ rm javadb.tar.gz
37+
38+ - name : Cache DBs
39+ uses : actions/cache/save@v4
40+ with :
41+ path : ${{ github.workspace }}/.cache/trivy
42+ key : cache-trivy-${{ steps.date.outputs.date }}
43+
Original file line number Diff line number Diff line change 33name : ' Trivy'
44description : ' Composite action to run trivy on the npm package.json'
55
6+
7+ inputs :
8+ TRIVY_SKIP_DB_UPDATE :
9+ description : " Whether trivy should use cache instead of pulling latest db"
10+ required : false
11+ default : true
12+ TRIVY_SKIP_JAVA_DB_UPDATE :
13+ description : " Whether trivy should use cache instead of pulling latest java db"
14+ required : false
15+ default : true
16+
617runs :
718 using : " composite"
819 steps :
@@ -13,14 +24,19 @@ runs:
1324 path : .docs-gha
1425
1526 # 0.23.0
27+ # Refer to https://github.com/aquasecurity/trivy-action#updating-caches-in-the-default-branch for the env vars
1628 - name : Run Trivy vulnerability scanner
17- uses : aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8
29+ uses : aquasecurity/trivy-action@0.28.0
1830 with :
1931 scan-type : ' fs'
2032 ignore-unfixed : true
2133 format : ' sarif'
2234 output : ' trivy-results.sarif'
2335 severity : ' CRITICAL'
36+ cache : ' true'
37+ env :
38+ TRIVY_SKIP_DB_UPDATE : ${{ inputs.TRIVY_SKIP_DB_UPDATE && inputs.TRIVY_SKIP_DB_UPDATE != 'false' }}
39+ TRIVY_SKIP_JAVA_DB_UPDATE : ${{ inputs.TRIVY_SKIP_JAVA_DB_UPDATE && inputs.TRIVY_SKIP_JAVA_DB_UPDATE != 'false' }}
2440
2541 - name : Upload Trivy scan results to GitHub Security tab
2642 uses : github/codeql-action/upload-sarif@v3
You can’t perform that action at this time.
0 commit comments