Also scan on push to default to show SARIF output #8
This file contains 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: create_and_scan_SBOM | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
create-sbom: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Generate SBOM with Syft | |
uses: anchore/sbom-action@v0 | |
with: | |
path: . | |
output-file: "${{ github.event.repository.name }}-sbom.cyclonedx.json" | |
format: "cyclonedx-json" | |
config: ".syft/config.yml" | |
- name: Scan SBOM with Grype | |
id: scan | |
uses: anchore/scan-action@v5 | |
with: | |
fail-build: false | |
by-cve: true | |
cache-db: true | |
sbom: "${{ github.event.repository.name }}-sbom.cyclonedx.json" | |
- name: Verify SARIF file | |
run: cat ${{ steps.scan.outputs.sarif }} | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: ${{ steps.scan.outputs.sarif }} | |
category: "syft_and_grype" |