diff --git a/.github/workflows/scan-vulns.yaml b/.github/workflows/scan-vulns.yaml index 4091c69124..0cb26bc1cf 100644 --- a/.github/workflows/scan-vulns.yaml +++ b/.github/workflows/scan-vulns.yaml @@ -47,6 +47,10 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT - name: Download trivy run: | @@ -55,10 +59,17 @@ jobs: tar zxvf trivy_${{ env.TRIVY_VERSION }}_Linux-64bit.tar.gz echo "$(pwd)" >> $GITHUB_PATH + - name: Restore trivy cache directory + uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + with: + path: ${{ github.workspace }}/.cache/trivy + key: cache-trivy-${{ steps.date.outputs.date }} + - name: Set up trivy cache directory run: | mkdir -p ~/.cache/trivy echo ${{ github.workspace }}/.cache/trivy + echo ~/.cache/trivy cp -r ${{ github.workspace }}/.cache/trivy ~/.cache/trivy - name: Run trivy on git repository