forked from DefenderK/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.77 KB
/
full-with-diff.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
53
54
55
56
57
58
59
60
61
name: Snyk Code PR Diff Scan
on:
pull_request:
branches: [ main ]
jobs:
snyk-pipeline:
runs-on: ubuntu-latest
name: Snyk Code PR Diff Scan
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
steps:
# Checkout base ref branch
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Download Snyk
run: |
wget -O snyk https://static.snyk.io/cli/latest/snyk-linux
chmod +x ./snyk
mv ./snyk /usr/local/bin/
- name: Authenticate Snyk
run: snyk auth ${SNYK_TOKEN}
- name: Run Snyk Code
run: snyk code test --json-file-output=${{ github.workspace }}/snyk_code_baseline.json
continue-on-error: true
# Upload the Snyk Code results from the main branch
- uses: actions/upload-artifact@v3
with:
name: snyk_code_baseline
path: ${{ github.workspace }}/snyk_code_baseline.json
# Checkout PR branch
- uses: actions/checkout@v3
- name: Authenticate Snyk
run: snyk auth ${SNYK_TOKEN}
- name: Run Snyk Code
run: |
sleep 10s
snyk code test --json-file-output=${{ github.workspace }}/snyk_code_pr.json || true
continue-on-error: true
# Upload the Snyk Code results from the PR scan
- uses: actions/upload-artifact@v3
with:
name: snyk_code_pr
path: ${{ github.workspace }}/snyk_code_pr.json
- uses: actions/download-artifact@v3
with:
name: snyk_code_baseline
- name: Check if new issues have been introduced via the PR
run: |
chmod +x "${{ github.workspace }}/.github/snyk-pr-diff-amd64-linux"
${{ github.workspace }}/.github/snyk-pr-diff-amd64-linux code ${{ github.workspace }}/snyk_code_baseline.json ${{ github.workspace }}/snyk_code_pr.json