Skip to content

Commit fb09703

Browse files
committed
Add Trivy
1 parent a3098b2 commit fb09703

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,47 @@ jobs:
5454
- name: Success
5555
run: echo "Success!"
5656

57+
# Upload Trivy data
58+
trivy:
59+
if: success() || failure() # Does not run on cancelled workflows
60+
runs-on: ubuntu-20.04
61+
needs:
62+
- tests
63+
64+
steps:
65+
# Git Checkout
66+
- name: Checkout Code
67+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
68+
with:
69+
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
70+
fetch-depth: 0
71+
72+
- name: Run Trivy vulnerability scanner in repo mode
73+
if: ${{ github.event_name == 'pull_request' }}
74+
uses: aquasecurity/[email protected]
75+
with:
76+
scan-type: 'fs'
77+
ignore-unfixed: true
78+
format: table
79+
exit-code: 1
80+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
81+
82+
- name: Run Trivy vulnerability scanner in repo mode
83+
if: ${{ github.event_name == 'schedule' }}
84+
uses: aquasecurity/[email protected]
85+
with:
86+
scan-type: 'fs'
87+
ignore-unfixed: true
88+
format: 'sarif'
89+
output: 'trivy-results.sarif'
90+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
91+
92+
- name: Upload Trivy scan results to GitHub Security tab
93+
if: ${{ github.event_name == 'schedule' }}
94+
uses: github/codeql-action/upload-sarif@v3
95+
with:
96+
sarif_file: 'trivy-results.sarif'
97+
5798
# Combine and upload coverage data
5899
coverage:
59100
if: success() || failure() # Does not run on cancelled workflows

0 commit comments

Comments
 (0)