Skip to content

Commit fe41bad

Browse files
authored
Create trivy.yml
1 parent 69a4d6c commit fe41bad

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/trivy.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# uses Trivy to scan every pull request, rejecting those with severe, fixable vulnerabilities
2+
# scans on PR to master and weekly with same behavior
3+
name: Trivy
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- master
9+
push:
10+
branches:
11+
- master
12+
# cron scan is same as codeql-analysis job
13+
schedule:
14+
- cron: '55 * * * *'
15+
16+
jobs:
17+
scan:
18+
19+
permissions:
20+
# for github/codeql-action/upload-sarif to upload SARIF results
21+
security-events: write
22+
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
# Run trivy and log detected and fixed vulnerabilities
29+
# This report should match the uploaded code scan report below
30+
# and is a convenience/redundant effort for those who prefer to
31+
# read logs and/or if anything goes wrong with the upload.
32+
- name: Log all detected vulnerabilities
33+
uses: aquasecurity/trivy-action@master
34+
with:
35+
scan-type: fs
36+
hide-progress: true
37+
ignore-unfixed: true
38+
39+
# Upload actionable results to the GitHub Security tab.
40+
# Pull request checks fail according to repository settings.
41+
# - https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
42+
# - https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning
43+
- name: Report actionable vulnerabilities
44+
uses: aquasecurity/trivy-action@master
45+
with:
46+
scan-type: fs
47+
ignore-unfixed: true
48+
format: 'sarif'
49+
output: 'trivy-results.sarif'
50+
51+
- name: Upload Trivy scan results to GitHub Security tab
52+
uses: github/codeql-action/upload-sarif@v2
53+
with:
54+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)