Skip to content

Instantly share code, notes, and snippets.

@abelaska
Created December 15, 2021 07:15
Show Gist options
  • Save abelaska/aa34629e7112fcde56beaf24556d35eb to your computer and use it in GitHub Desktop.
Save abelaska/aa34629e7112fcde56beaf24556d35eb to your computer and use it in GitHub Desktop.
Github Workflow - Snyk Security Check
# .github/workflows/snyk.yaml
name: Snyk Security Check
on:
push:
schedule:
# At 03:00 on every day-of-week from Sunday through Friday. https://crontab.guru/#0_3_*_*_0-5
- cron: '0 3 * * 0-5'
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.6
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'pnpm'
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v2
env:
cache-name: cache-deps
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: pnpm i
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --sarif-file-output=snyk.sarif
- name: Upload Snyk scan result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: snyk.sarif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment