Skip to content

Commit c1cfbbd

Browse files
committed
trivy action
1 parent 0c7b343 commit c1cfbbd

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/trivy-scan.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
# cron scan is same as codeql-analysis job
4+
name: Trivy
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- master
10+
push:
11+
branches:
12+
- master
13+
schedule:
14+
- cron: '10 18 * * 2'
15+
16+
jobs:
17+
scan:
18+
runs-on: ubuntu-latest
19+
20+
if: ${{ github.repository == 'CrunchyData/postgres-operator' }}
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Log all detected vulnerabilities
26+
uses: aquasecurity/trivy-action@master
27+
with:
28+
scan-type: fs
29+
hide-progress: true
30+
31+
# Upload actionable results to the GitHub Security tab.
32+
# Pull request checks fail according to repository settings.
33+
#
34+
# - https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github
35+
# - https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning
36+
- name: Report actionable vulnerabilities
37+
uses: aquasecurity/trivy-action@master
38+
with:
39+
scan-type: fs
40+
ignore-unfixed: true
41+
format: 'sarif'
42+
output: 'trivy-results.sarif'
43+
44+
- name: Upload Trivy scan results to GitHub Security tab
45+
uses: github/codeql-action/upload-sarif@v2
46+
with:
47+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)