feat: add setup-db

This commit is contained in:
2025-11-08 17:15:48 +01:00
parent fa5097ea2e
commit 5f620bd6d9
2 changed files with 75 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
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 }}"