File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ # https://github.com/aquasecurity/trivy-action?tab=readme-ov-file#updating-caches-in-the-default-branch
2+ # This workflow is needed to get around rate limiting on ghcr. This will update the trivy DBs in the
3+ # github cache to allow the trivy scans themselves to run without pulling the DB. This will allow the
4+ # scans to run without running into rate limit issues. This workflow could run into those issues when
5+ # downloading the cache, but as long as it succeeds more often than it fails, we will have our bases
6+ # covered.
7+ name : Update Trivy DB Caches
8+
9+ on :
10+ workflow_dispatch :
11+ schedule :
12+ - cron : ' 17 2 * * *' # Daily at random time (2:17am UTC)
13+
14+ jobs :
15+ update-caches :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Setup oras
19+ uses : oras-project/setup-oras@v1
20+
21+ - name : Get current date
22+ id : date
23+ run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
24+
25+ - name : Download and extract the vulnerability DB
26+ run : |
27+ mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db
28+ oras pull ghcr.io/aquasecurity/trivy-db:2
29+ tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db
30+ rm db.tar.gz
31+
32+ - name : Download and extract the Java DB
33+ run : |
34+ mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db
35+ oras pull ghcr.io/aquasecurity/trivy-java-db:1
36+ tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db
37+ rm javadb.tar.gz
38+
39+ - name : Cache DBs
40+ uses : actions/cache/save@v4
41+ with :
42+ path : ${{ github.workspace }}/.cache/trivy
43+ key : cache-trivy-${{ steps.date.outputs.date }}
You can’t perform that action at this time.
0 commit comments