Skip to content

Snyk Container Scan #18

Snyk Container Scan

Snyk Container Scan #18

name: Snyk Container Scan
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]
schedule:
# Wednesday at 1:30 PM UTC — staggers from the other weekly scans (Monday 9am)
- cron: '30 13 * * 3'
permissions:
contents: read
security-events: write
actions: read
jobs:
snyk:
name: Snyk Docker Image Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Build Docker image
if: env.SNYK_TOKEN != ''
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: docker build -t prostaff-api:${{ github.sha }} .
- name: Run Snyk container scan
if: env.SNYK_TOKEN != ''
continue-on-error: true
uses: snyk/actions/docker@14818c4695ecc4045f33c9cee9e795a788711ca4
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: prostaff-api:${{ github.sha }}
args: --file=Dockerfile --severity-threshold=high
- name: Upload SARIF to GitHub Code Scanning
# Only upload if the sarif file was produced (snyk may not create it on auth failure)
if: always() && hashFiles('snyk.sarif') != ''
uses: github/codeql-action/upload-sarif@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3
with:
sarif_file: snyk.sarif