ci(trivy): add scheduled security scan workflow
Some checks failed
v1 version / test scp action (push) Failing after 17m8s
v1 version / test deploy artifact (push) Failing after 48s
v1 version / test changed-files (push) Failing after 1m54s
v1 version / test target folder (push) Failing after 5m9s
v1 version / test Multiple Host (push) Failing after 17m10s
lint and test / test scp action (push) Failing after 3m39s
lint and test / test deploy artifact (push) Failing after 12s
lint and test / test changed-files (push) Failing after 1m26s
lint and test / test target folder (push) Failing after 3m50s
lint and test / test Multiple Host (push) Failing after 1m15s
Trivy Security Scan / Trivy Security Scan (push) Failing after 48m5s

- Scan the repository filesystem for CRITICAL and HIGH vulnerabilities and upload SARIF results to the GitHub Security tab
- Run quarterly on a schedule, on manual dispatch, and on pushes and pull requests to the default branch

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bo-Yi Wu
2026-08-09 12:50:38 +08:00
parent 6dba043acb
commit 7e85c2e09a

50
.github/workflows/trivy.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Trivy Security Scan
on:
schedule:
# Run at 00:00 on day 1 of every 3rd month (January, April, July, October)
- cron: "0 0 1 */3 *"
workflow_dispatch: # Allow manual trigger
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
security-events: write # For uploading results to GitHub Security tab
jobs:
trivy-scan:
name: Trivy Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: "fs"
scan-ref: "."
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH"
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: "trivy-results.sarif"
- name: Run Trivy vulnerability scanner (table output)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: "fs"
scan-ref: "."
format: "table"
severity: "CRITICAL,HIGH"
exit-code: "1"