Code Scanning #89
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Code Scanning" | |
on: | |
push: | |
branches: [ main ] # Trigger the workflow on push to the main branch | |
pull_request: | |
branches: [ main ] # Trigger the workflow on pull requests targeting the main branch | |
workflow_dispatch: # Allow manual trigger of the workflow | |
schedule: | |
- cron: '0 0 * * 1' | |
watch: | |
types: [started] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: on_demand | |
jobs: | |
Trivy-Scan: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set lowercase repo name | |
run: echo "REPO_NAME_LOWER=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: '${{ env.REGISTRY }}/${{ env.REPO_NAME_LOWER }}/${{ env.IMAGE_NAME }}:latest' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: 'trivy-results.sarif' |