File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Snyk Security Scan
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ schedule :
9+ # Run daily at 2 AM UTC
10+ - cron : ' 0 2 * * *'
11+ workflow_dispatch :
12+
13+ jobs :
14+ snyk-scan :
15+ runs-on : ubuntu-latest
16+ environment : snyk
17+
18+ permissions :
19+ contents : read
20+ security-events : write
21+ actions : read
22+
23+ steps :
24+ - name : Checkout code
25+ uses : actions/checkout@v4
26+
27+ - name : Set up Node.js
28+ uses : actions/setup-node@v4
29+ with :
30+ node-version : ' 22'
31+
32+ - name : Verify Snyk token exists
33+ run : |
34+ if [ -z "${{ secrets.SNYK_TOKEN }}" ]; then
35+ echo "❌ ERROR: SNYK_TOKEN secret is not set"
36+ exit 1
37+ else
38+ echo "✅ SNYK_TOKEN secret is configured"
39+ fi
40+
41+ - name : Install dependencies
42+ if : hashFiles('package.json') != ''
43+ run : npm install
44+
45+ - name : Run Snyk to check for vulnerabilities
46+ uses : snyk/actions/node@master
47+ continue-on-error : true
48+ env :
49+ SNYK_TOKEN : ${{ secrets.SNYK_TOKEN }}
50+ with :
51+ args : --all-projects --severity-threshold=medium
52+
53+ - name : Run Snyk Monitor (track project)
54+ if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
55+ uses : snyk/actions/node@master
56+ env :
57+ SNYK_TOKEN : ${{ secrets.SNYK_TOKEN }}
58+ with :
59+ command : monitor
60+ args : --all-projects
You can’t perform that action at this time.
0 commit comments