File tree Expand file tree Collapse file tree 2 files changed +61
-2
lines changed Expand file tree Collapse file tree 2 files changed +61
-2
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 3
3
name : ' Trivy'
4
4
description : ' Composite action to run trivy on the npm package.json'
5
5
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
+
6
17
runs :
7
18
using : " composite"
8
19
steps :
@@ -12,15 +23,20 @@ runs:
12
23
repository : Consensys/docs-gha
13
24
path : .docs-gha
14
25
15
- # 0.23.0
26
+ # 0.28.0
27
+ # Refer to https://github.com/aquasecurity/trivy-action#updating-caches-in-the-default-branch for the env vars
16
28
- name : Run Trivy vulnerability scanner
17
- uses : aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8
29
+ uses : aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2
18
30
with :
19
31
scan-type : ' fs'
20
32
ignore-unfixed : true
21
33
format : ' sarif'
22
34
output : ' trivy-results.sarif'
23
35
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' }}
24
40
25
41
- name : Upload Trivy scan results to GitHub Security tab
26
42
uses : github/codeql-action/upload-sarif@v3
You can’t perform that action at this time.
0 commit comments