From d9b7c11679ab85e02b675a8cf8a74ea68a00de02 Mon Sep 17 00:00:00 2001 From: knqyf263 Date: Mon, 7 Oct 2024 15:49:17 +0400 Subject: [PATCH] feat: use date for cache key Signed-off-by: knqyf263 --- action.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 4048233..93f3ce1 100644 --- a/action.yaml +++ b/action.yaml @@ -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