diff --git a/.github/workflows/scan-pull-request.yml b/.github/workflows/scan-pull-request.yml new file mode 100644 index 0000000..167efd6 --- /dev/null +++ b/.github/workflows/scan-pull-request.yml @@ -0,0 +1,30 @@ +name: Scan repo on PR + +on: + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@0.33.1 + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + if: always() + with: + sarif_file: 'trivy-results.sarif'