Files
sec-actions/setup-db/action.yaml
T
2025-11-08 17:15:48 +01:00

32 lines
922 B
YAML

name: "Setup Trivy DB"
description: "Setup the trivy database, restoring from cache if available"
author: "Timo Behrendt <t.behrendt@t00n.de"
branding:
icon: "database"
color: "blue"
inputs:
cache-dir:
description: "Path to the Trivy cache directory (default: ~/.cache/trivy)"
required: false
default: "~/.cache/trivy"
runs:
using: "composite"
steps:
- id: current-date
shell: bash
run: |
echo "current-date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
- id: restore-db
uses: actions/cache@v4
with:
path: ${{ inputs.cache-dir }}
key: trivy-db-${{ steps.current-date.outputs.current-date }}
restore-keys: |
trivy-db-${{ steps.current-date.outputs.current-date }}
trivy-db-
- if: steps.restore-db.outputs.cache-hit != 'true'
shell: bash
run: trivy fs --download-db-only --cache-dir "${{ inputs.cache-dir }}"