Skip to content

update gh actions

update gh actions #58

name: trivy
on:
push:
# Currently limited to main because of the following:
# Workflows triggered by Dependabot on the "push" event run with read-only access. Uploading Code Scanning results requires write access.
# To use Code Scanning with Dependabot, please ensure you are using the "pull_request" event for this workflow and avoid triggering on the "push" event for Dependabot branches.
# See https://docs.github.com/en/code-security/secure-coding/configuring-code-scanning#scanning-on-push for more information on how to configure these events.
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
jobs:
trivy:
name: Trivy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Build an image from Dockerfile
run: |
docker build -t majodev/go-docker-vscode:${{ github.sha }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'majodev/go-docker-vscode:${{ github.sha }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
ignore-unfixed: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'