Skip to content

Commit 41586a9

Browse files
committed
Enable trivy scan in CI
For vulnerability scan Signed-off-by: Wei Liu <[email protected]>
1 parent 7b7a873 commit 41586a9

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/trivy.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: trivy
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
# The branches below must be a subset of the branches above
13+
branches: [ "main" ]
14+
schedule:
15+
- cron: '0 0 * * 1'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
permissions:
23+
contents: read # for actions/checkout to fetch code
24+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
25+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
26+
name: Build
27+
runs-on: "ubuntu-20.04"
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Run Trivy vulnerability scanner
33+
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe
34+
with:
35+
scan-type: 'fs'
36+
ignore-unfixed: true
37+
format: 'sarif'
38+
template: '@/contrib/sarif.tpl'
39+
output: 'trivy-results.sarif'
40+
severity: 'CRITICAL,HIGH'
41+
42+
- name: Upload Trivy scan results to GitHub Security tab
43+
uses: github/codeql-action/upload-sarif@v2
44+
with:
45+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)