feat: add setup-db (#11)
CD / Release (push) Successful in 14s

Reviewed-on: t.behrendt/trivy-actions#11
Reviewed-by: branch-buddy <branch-buddy@t00n.de>
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #11.
This commit is contained in:
2025-11-08 17:31:15 +01:00
committed by t.behrendt
parent fa5097ea2e
commit 463eaebe9f
3 changed files with 95 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 }}"