Security scan #85
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: Security scan | |
| on: | |
| schedule: | |
| - cron: 0 2 * * 1-5 | |
| workflow_dispatch: | |
| jobs: | |
| trivy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write # upload sarif results | |
| steps: | |
| - name: Determine latest release | |
| id: latest-release | |
| if: github.event.release.tag_name == '' | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh api 'repos/{owner}/{repo}/releases/latest' --jq '"tag-name=\(.tag_name)"' >>"$GITHUB_OUTPUT" | |
| # The checkout is solely required for the upload-sarif action. It needs to | |
| # know the ref and sha. Providing those manually won't work, for unknown | |
| # reasons. | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| ref: ${{ format('refs/tags/{0}', github.event.release.tag_name || steps.latest-release.outputs.tag-name) }} | |
| persist-credentials: false | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | |
| with: | |
| image-ref: ${{ format('quay.io/{0}:{1}', github.repository, github.event.release.tag_name || steps.latest-release.outputs.tag-name) }} | |
| format: sarif | |
| output: trivy-results.sarif | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@b8d3b6e8af63cde30bdc382c0bc28114f4346c88 # v2.28.1 | |
| with: | |
| sarif_file: trivy-results.sarif |