Skip to content

Commit

Permalink
Add Trivy
Browse files Browse the repository at this point in the history
  • Loading branch information
hmstepanek committed Sep 16, 2024
1 parent 892e66c commit be31f7f
Showing 1 changed file with 41 additions and 0 deletions.
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

0 comments on commit be31f7f

Please sign in to comment.