Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Trivy to CI #1213

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,47 @@ jobs:
- name: Success
run: echo "Success!"

# Upload Trivy data
trivy:
if: success() || failure() # Does not run on cancelled workflows
runs-on: ubuntu-20.04
needs:
- tests

steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Run Trivy vulnerability scanner in repo mode
if: ${{ github.event_name == 'pull_request' }}
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
ignore-unfixed: true
format: table
exit-code: 1
severity: 'CRITICAL,HIGH,MEDIUM,LOW'

- name: Run Trivy vulnerability scanner in repo mode
if: ${{ github.event_name == 'schedule' }}
uses: aquasecurity/[email protected]
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH,MEDIUM,LOW'

- name: Upload Trivy scan results to GitHub Security tab
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'

# Combine and upload coverage data
coverage:
if: success() || failure() # Does not run on cancelled workflows
Expand Down
Loading