File tree 1 file changed +32
-0
lines changed 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Note: This workflow only updates the cache. You should create a separate workflow for your actual Trivy scans.
2
+ # In your scan workflow, set TRIVY_SKIP_DB_UPDATE=true and TRIVY_SKIP_JAVA_DB_UPDATE=true.
3
+ name : Update Trivy Cache
4
+
5
+ on :
6
+ schedule :
7
+ - cron : ' 0 0 * * *' # Run daily at midnight UTC
8
+ workflow_dispatch : # Allow manual triggering
9
+
10
+ jobs :
11
+ update-trivy-db :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Setup oras
15
+ uses : oras-project/setup-oras@v1
16
+
17
+ - name : Get current date
18
+ id : date
19
+ run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
20
+
21
+ - name : Download and extract the vulnerability DB
22
+ run : |
23
+ mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db
24
+ oras pull ghcr.io/aquasecurity/trivy-db:2
25
+ tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db
26
+ rm db.tar.gz
27
+
28
+ - name : Cache DBs
29
+ uses : actions/cache/save@v4
30
+ with :
31
+ path : ${{ github.workspace }}/.cache/trivy
32
+ key : cache-trivy-${{ steps.date.outputs.date }}
You can’t perform that action at this time.
0 commit comments