-
Notifications
You must be signed in to change notification settings - Fork 2k
80 lines (71 loc) · 2.18 KB
/
snyk-python-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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 🚨 Snyk Python Scan
on:
push:
paths-ignore:
- '**.md'
branches:
- long_lived/**
- main
- release/**
tags:
- '**'
pull_request:
paths-ignore:
- '**.md'
branches:
- '**'
workflow_dispatch:
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
permissions:
contents: read
jobs:
snyk_python:
name: Scan the dependencies of Chia Blockchain
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
steps:
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SNYK_SECRET
if [ -n "$SNYK_TOKEN" ]; then HAS_SNYK_SECRET='true' ; fi
echo HAS_SNYK_SECRET=${HAS_SNYK_SECRET} >> "$GITHUB_OUTPUT"
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Checkout Code
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python environment
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Chia Blockchain
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}
development: true
- name: Activate Chia venv
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
uses: chia-network/actions/activate-venv@main
- name: Generate requirements.txt file
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
run: |
pip freeze > requirements.txt
- name: Run Snyk to check for vulnerabilities
if: steps.check_secrets.outputs.HAS_SNYK_SECRET
uses: snyk/actions/python@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --skip-unresolved