diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml new file mode 100644 index 000000000..3b3c8bf65 --- /dev/null +++ b/.github/workflows/trivy.yaml @@ -0,0 +1,42 @@ +name: Trivy Image Scanner + +on: + workflow_dispatch: + pull_request: + schedule: + - cron: 00 01 * * * + +permissions: + contents: read + +jobs: + latest-scan: + name: Scan Latest Image tag + runs-on: ubuntu-latest + steps: + + - name: Pull image + run: docker pull ghcr.io/antonbabenko/pre-commit-terraform:latest + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 + with: + image-ref: ghcr.io/antonbabenko/pre-commit-terraform:latest + exit-code: '1' + severity: CRITICAL + ignore-unfixed: true + + nightly-scan: + name: Scan Nightly Image tag + runs-on: ubuntu-latest + steps: + - name: Pull image + run: docker pull ghcr.io/antonbabenko/pre-commit-terraform:nightly + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 + with: + image-ref: ghcr.io/antonbabenko/pre-commit-terraform:nightly + exit-code: '1' + severity: CRITICAL + ignore-unfixed: true