-
Notifications
You must be signed in to change notification settings - Fork 157
66 lines (55 loc) · 1.93 KB
/
snyk-scan.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
62
63
64
65
66
name: Snyk Security Vulnerability Scan
on:
workflow_dispatch:
pull_request:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
branches:
- 'main'
jobs:
snyk_scan_test:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: snyk/actions/setup@master
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Check changed Deps files
uses: tj-actions/changed-files@v35
id: changed-files
with:
files: |
**/requirements*.txt
- name: Snyk scan for Python dependencies
if: steps.changed-files.outputs.any_changed == 'true'
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
python3 -m pip install -r $file
snyk test --command=python3 --package-manager=pip --file=$file -d --skip-unresolved
done
snyk_scan_monitor:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Extract github branch/tag name
shell: bash
run: echo "ref=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT
id: extract_ref
- uses: actions/checkout@master
- uses: snyk/actions/setup@master
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Snyk scan for Python dependencies
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: |
for file in requirements*.txt; do
python3 -m pip install -r $file
snyk monitor --command=python3 --skip-unresolved --org=py_data_table --remote-repo-url=datatable/${{ steps.extract_ref.outputs.ref }} --package-manager=pip --file=$file --project-name=PY-DATA-TABLE/datatable/${{ steps.extract_ref.outputs.ref }}/$file -d --fail-on=all
done