-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.25 KB
/
securityCheck.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
name: Snyk Security Check
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Run Snyk to check for vulnerabilities
id: snyk
uses: snyk/actions/node@master
continue-on-error: true # Continue to comment even if vulnerabilities are found
with:
args: --json-file-output=snyk-results.json
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Read Snyk results
id: snyk_results
run: |
SNYK_RESULT=$(cat snyk-results.json)
echo "::set-output name=snyk_result::$SNYK_RESULT"
- name: Comment PR with Snyk results
if: github.event_name == 'pull_request'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
### 🛡️ Snyk Security Results
```
${{ steps.snyk_results.outputs.snyk_result }}
```
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}