Skip to content

Commit

Permalink
Move Trivy image scan to a scheduled workflow (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
runejo authored Dec 16, 2024
1 parent 3e73253 commit 2dfa6a1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 11 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,4 @@ jobs:
context: .
load: true
tags: pxwebapi:${{ github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: image
image-ref: pxwebapi:${{ github.sha }}
format: sarif
output: trivy-results.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif

48 changes: 48 additions & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Trivy Image Scan
on:
push:
branches: ["main"]
workflow_dispatch:
schedule:
- cron: "5 11 * * 0"

permissions:
contents: read

jobs:
docker:
permissions:
contents: read
security-events: write
actions: read
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: pxwebapi:${{ github.sha }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
scan-type: image
image-ref: pxwebapi:${{ github.sha }}
format: sarif
output: trivy-results.sarif

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif

0 comments on commit 2dfa6a1

Please sign in to comment.