Skip to content

Commit

Permalink
github: Use restore-keys to get the lastest cache
Browse files Browse the repository at this point in the history
restore-keys will get the latest cache with a key that has the specified prefix

Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Nov 19, 2024
1 parent 50dd914 commit f9d97d4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: /home/runner/vuln-cache
key: trivy-latest-cache
key: download-failed # Use a non existing key to fallback to restore-keys
restore-keys: |
trivy-cache-
- name: Run Trivy vulnerability scanner
run: |
Expand All @@ -52,12 +54,10 @@ jobs:
--output trivy-lxd-repo-scan-results.sarif .
- name: Cache Trivy vulnerability database
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: /home/runner/vuln-cache
key: trivy-latest-cache-${{ github.run_id }}
restore-keys: |
trivy-latest-cache
key: trivy-cache-${{ github.run_id }}

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3.27.1
Expand Down Expand Up @@ -89,7 +89,9 @@ jobs:
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: /home/runner/vuln-cache
key: trivy-latest-cache
key: download-failed # Use a non existing key to fallback to restore-keys
restore-keys: |
trivy-cache-
- name: Download snap for scan
run: |
Expand Down

0 comments on commit f9d97d4

Please sign in to comment.