Repository navigation
Potential fix for pull request finding #209
Workflow file for this run
This file contains hidden or 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: Scan repository | |
| on: | |
| workflow_dispatch: | |
| push: | |
| release: | |
| types: [created] | |
| permissions: | |
| actions: read | |
| contents: write | |
| security-events: write | |
| packages: write | |
| env: | |
| is_release: ${{ github.event_name == 'release' && github.event.action == 'created' && ! github.event.release.prerelease }} | |
| is_main: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| jobs: | |
| scan_repo: | |
| name: Scan repository | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run vulnerability scanner | |
| if: ${{ env.is_release == 'true' || env.is_main == 'true' }} | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| image-ref: . | |
| severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| limit-severities-for-sarif: true | |
| - name: Upload scan results to GitHub Security tab | |
| if: ${{ env.is_release == 'true' || env.is_main == 'true' }} | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: 'trivy-results.sarif' | |
| - name: Update GitHub Dependency Graph | |
| if: ${{ env.is_release == 'true' || env.is_main == 'true' }} | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| image-ref: . | |
| format: github | |
| output: sbom.github.json | |
| github-pat: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate CycloneDX SBOM | |
| uses: aquasecurity/trivy-action@0.35.0 | |
| with: | |
| scan-type: 'fs' | |
| image-ref: . | |
| format: cyclonedx | |
| output: sbom.cdx.json | |
| - name: Upload CycloneDX SBOM | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: repo-cyclonedx-sbom | |
| path: sbom.cdx.json | |
| - name: Upload SBOM to GitHub Release | |
| if: ${{ env.is_release == 'true' }} | |
| run: | | |
| gh release upload ${{ github.event.release.tag_name }} \ | |
| sbom.cdx.json --clobber --repo ${{ github.repository }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |