-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (47 loc) · 1.49 KB
/
vulnerability-scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: vulnerability-scan-schedule
run-name: Scheduled CVE vulnerability scan of published images.
env:
REGISTRY: ghcr.io
on:
workflow_dispatch:
jobs:
setup-matrix:
runs-on: ubuntu-latest
steps:
- if: github.ref_name == '5.x' || github.ref_name == 'feature/291--add-generic-scan-workflow'
uses: druzsan/setup-matrix@v2
with:
matrix: |
images: ${{ vars.IMAGES }}
exclude:
- images: "mailpit"
- if: github.ref_name != '5.x'
uses: druzsan/setup-matrix@v2
with:
matrix: |
images: ${{ vars.IMAGES }}
- id: setup-matrix
run: echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
vulnerability-scan-schedule:
runs-on: ubuntu-latest
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Scan for vulnerabilities
id: scan
uses: crazy-max/ghaction-container-scan@v3
with:
image: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }}:5.x
annotations: true
dockerfile: ./images/${{ matrix.images }}
- name: Upload SARIF file
if: ${{ steps.scan.outputs.sarif != '' }}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.scan.outputs.sarif }}