Skip to content

scan-trivy.yml

Run Trivy vulnerability scans on container images and/or configuration files and upload SARIF reports to GitHub Security.

Inputs

InputTypeDescriptionRequiredDefault
IMAGEstringImage used to perform scan (eg. docker.io/debian:latest)No-
PATHstringPath used to perform config scanNo-

Permissions

ScopeAccessDescription
contentswriteGeneral repo operations by jobs
security-eventswriteUpload SARIF to code scanning
pull-requestswritePost a comment on the pull request

Notes

  • images-scan runs only if IMAGE is provided; config-scan runs only if PATH is provided
  • Uploads SARIF results to the Security tab; on pull requests, posts a comment linking to the Security panel when both IMAGE and PATH are set
  • Skips common directories via skip-dirs: **/node_modules in config scan

Examples

Simple example

yaml
jobs:
  vuln-scan:
    uses: this-is-tobi/github-workflows/.github/workflows/scan-trivy.yml@main
    with:
      IMAGE: ghcr.io/my-org/my-image:1.2.3
      PATH: ./apps/api