|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +# This workflow checks out code, builds an image, performs a container image |
| 7 | +# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security |
| 8 | +# code scanning feature. For more information on the Anchore scan action usage |
| 9 | +# and parameters, see https://github.com/anchore/scan-action. For more |
| 10 | +# information on Anchore's container image scanning tool Grype, see |
| 11 | +# https://github.com/anchore/grype |
| 12 | +name: Anchore Grype vulnerability scan |
| 13 | + |
| 14 | +on: |
| 15 | + schedule: |
| 16 | + - cron: '0 0 * * 1' # Jeden Montag um 00:00 Uhr |
| 17 | + registry_package: |
| 18 | + types: [published] |
| 19 | + workflow_dispatch: |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + packages: read |
| 24 | + |
| 25 | +jobs: |
| 26 | + Anchore-Build-Scan: |
| 27 | + permissions: |
| 28 | + contents: read # for actions/checkout to fetch code |
| 29 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 30 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Check out the code |
| 34 | + uses: actions/checkout@v4 |
| 35 | + - name: Log in to registry |
| 36 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 37 | + - name: Run the Anchore Grype scan action |
| 38 | + uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7 |
| 39 | + id: scan |
| 40 | + with: |
| 41 | + image: "ghcr.io/lm-development/aks-sample/aks-sample:latest" |
| 42 | + fail-build: false |
| 43 | + - name: Upload vulnerability report |
| 44 | + uses: github/codeql-action/upload-sarif@v3 |
| 45 | + with: |
| 46 | + sarif_file: ${{ steps.scan.outputs.sarif }} |
0 commit comments