-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (49 loc) · 1.87 KB
/
nightly-vuln-scanning.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
48
49
50
51
52
name: Run nightly vulnerability check
on:
push:
branches:
- container-vuln-scanner
schedule:
- cron: '0 0 * * *'
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
container-vuln-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.20.0
id: runscanner
continue-on-error: true
with:
image-ref: 'ghcr.io/pulibrary/dpul-collections:main'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
output: 'vulnerabilities.table'
- name: Set variables
id: scanner
run: echo "results=$(cat vulnerabilities.table)" >> $GITHUB_OUTPUT
- name: Output variable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SCANNER_OUTPUTS: ${{ steps.scanner.outputs.results }}
run: echo "${{ env.SCANNER_OUTPUTS }}"
- name: Create issue
if: job.steps.runscanner.status == failure()
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SCANNER_OUTPUTS: ${{ steps.scanner.outputs.results }}
with:
filename: .github/failed-vuln-check.md
update_existing: true