diff --git a/trivy-fs-scan/action.yaml b/trivy-fs-scan/action.yaml index d8c13bf..097a8bb 100644 --- a/trivy-fs-scan/action.yaml +++ b/trivy-fs-scan/action.yaml @@ -72,6 +72,32 @@ runs: run: | touch .trivyignore + - name: Setup oras + uses: oras-project/setup-oras@v1 + + - name: Get current date + shell: sh + id: date + run: | + echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Download and extract the vulnerability DB + shell: sh + run: | + mkdir -p $GITHUB_WORKSPACE/.cache/trivy/db + oras pull ghcr.io/aquasecurity/trivy-db:2 + tar -xzf db.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/db + rm db.tar.gz + + - name: Download and extract the Java DB + shell: sh + run: | + mkdir -p $GITHUB_WORKSPACE/.cache/trivy/java-db + oras pull ghcr.io/aquasecurity/trivy-java-db:1 + tar -xzf javadb.tar.gz -C $GITHUB_WORKSPACE/.cache/trivy/java-db + rm javadb.tar.gz + + - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: @@ -88,6 +114,9 @@ runs: skip-dirs: ${{ inputs.skip-dirs }} skip-files: ${{ inputs.skip-files }} exit-code: '1' + env: + TRIVY_SKIP_DB_UPDATE: 'true' + TRIVY_SKIP_JAVA_DB_UPDATE: 'true' - name: Upload Trivy scan results to GitHub Security tab uses: github/codeql-action/upload-sarif@v2 @@ -100,4 +129,4 @@ runs: if: ${{ (success() || failure()) && inputs.output-mode == 'github' && inputs.category != '' }} with: sarif_file: ${{ steps.output.outputs.TRIVY_OUTPUT }} - category: ${{ inputs.category }} \ No newline at end of file + category: ${{ inputs.category }}