diff --git a/setup-trivy/action.yaml b/setup-trivy/action.yaml index c266cc1..745583f 100644 --- a/setup-trivy/action.yaml +++ b/setup-trivy/action.yaml @@ -14,17 +14,8 @@ inputs: runs: using: "composite" steps: - - name: Cache Trivy binary - id: cache-trivy - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 - with: - path: /usr/local/bin/trivy - key: trivy-${{ inputs.version }}-${{ inputs.architecture }} - restore-keys: | - trivy-${{ inputs.version }}-${{ inputs.architecture }}- - trivy-${{ inputs.version }}- - - shell: bash + id: arch run: | set -e case "$(uname -m)" in @@ -36,6 +27,14 @@ runs: ;; esac echo "ARCH=$ARCH" >> $GITHUB_OUTPUT + - name: Cache Trivy binary + id: cache-trivy + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: /usr/local/bin/trivy + key: trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }} + restore-keys: | + trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }} - name: Download and install Trivy if: steps.cache-trivy.outputs.cache-hit != 'true' shell: bash @@ -46,7 +45,7 @@ runs: mkdir -p /usr/local/bin - curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${ARCH}.tar.gz" -o trivy.tar.gz + curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${{ steps.arch.outputs.arch }}.tar.gz" -o trivy.tar.gz tar -xzf trivy.tar.gz chmod +x trivy mv trivy /usr/local/bin/