Skip to content

Commit

Permalink
feat: use date for cache key
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed Oct 7, 2024
1 parent a67f7cb commit d9b7c11
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,17 @@ runs:
shell: bash
run: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin ${{ inputs.version }}

- name: Get current date
id: date
shell: bash
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Restore DB from cache
if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: ${{ inputs.cache-dir }}
key: cache-trivy-db-${{ github.run_id }}
key: cache-trivy-db-${{ steps.date.outputs.date }}
restore-keys: cache-trivy-db- # In most cases, the cache is restored by 'restore-keys'.

- name: Set GitHub Path
Expand Down

0 comments on commit d9b7c11

Please sign in to comment.