Skip to content

Commit b8b3048

Browse files
committed
fix: add workaround for inaccessible contrib templates
1 parent 6442007 commit b8b3048

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

action.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@ runs:
155155
version: v0.69.3
156156
cache: true
157157

158+
- name: Copy Trivy contrib templates
159+
shell: bash
160+
run: |
161+
set -euo pipefail
162+
SRC_DIR="$HOME/.local/bin/trivy-bin/contrib"
163+
164+
if [ ! -f "$SRC_DIR/junit.tpl" ]; then
165+
echo "::error::Trivy JUnit template not found at $SRC_DIR/junit.tpl"
166+
ls -R "$SRC_DIR" || true
167+
exit 1
168+
fi
169+
170+
if [ ! -f "$SRC_DIR/html.tpl" ]; then
171+
echo "::error::Trivy HTML template not found at $SRC_DIR/html.tpl"
172+
ls -R "$SRC_DIR" || true
173+
exit 1
174+
fi
175+
176+
cp "$SRC_DIR/junit.tpl" ./trivy-junit.tpl
177+
cp "$SRC_DIR/html.tpl" ./trivy-html.tpl
178+
158179
- name: Restore trivy cache
159180
id: cache-trivy-restore
160181
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
@@ -207,7 +228,7 @@ runs:
207228
scan-ref: "${{ env.REPORT_SLUG }}-sbom.json"
208229
scan-type: sbom
209230
format: "template"
210-
template: "@$HOME/.local/bin/trivy-bin/contrib/junit.tpl"
231+
template: "@trivy-junit.tpl"
211232
output: "${{ inputs.junit-test-output != '' && inputs.junit-test-output || 'trivy.xml' }}"
212233
ignore-unfixed: true
213234
vuln-type: "os,library"
@@ -229,7 +250,7 @@ runs:
229250
scan-ref: "${{ env.REPORT_SLUG }}-sbom.json"
230251
scan-type: sbom
231252
format: "template"
232-
template: "@$HOME/.local/bin/trivy-bin/contrib/html.tpl"
253+
template: "@trivy-html.tpl"
233254
output: ${{ env.REPORT_FILENAME }}
234255
cache-dir: .trivy
235256
cache: "false" # use our own cache handling

0 commit comments

Comments
 (0)