Skip to content

Commit e95760d

Browse files
authored
Merge pull request #843 from GSA/new-snyk
new way to doing snyk
2 parents 37cd9c2 + da9f7a8 commit e95760d

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

.github/workflows/snyk.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
---
2-
name: Check for Snyk Vulnerabilities
2+
name: Snyk Security
33

4-
on: # yamllint disable-line rule:truthy
4+
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: '0 12 * * *' # every day at 12pm UTC
7+
# Run weekly on Sundays at 2:00 AM EST (7:00 AM UTC)
8+
- cron: '0 7 * * 0'
9+
push:
10+
branches:
11+
- main
812

913
jobs:
10-
snyk:
14+
snyk-test:
1115
name: snyk test
1216
runs-on: ubuntu-latest
17+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
security-events: write
1322
steps:
1423
- name: Checkout
1524
uses: actions/checkout@v4
@@ -80,3 +89,40 @@ jobs:
8089
snyk
8190
draft: false
8291
# yamllint enable rule:line-length
92+
93+
snyk-monitor:
94+
name: snyk monitor
95+
runs-on: ubuntu-latest
96+
if: github.event_name == 'push'
97+
permissions:
98+
contents: read
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Set up Python 3.10
104+
uses: actions/setup-python@v5
105+
with:
106+
python-version: 3.10.14
107+
cache: 'pip'
108+
109+
- name: Display Python version
110+
run: python -c "import sys; print(sys.version)"
111+
112+
- name: Install Dependencies
113+
run: |
114+
npm install snyk -g
115+
sudo apt-get update -y
116+
sudo apt-get install -y \
117+
openssl libssl-dev libffi-dev pkg-config libxml2-dev \
118+
libxmlsec1-dev libxmlsec1-openssl libgeos-dev proj-bin \
119+
libpq-dev
120+
pip3 install -r requirements.txt
121+
122+
- name: Run Snyk Monitor
123+
run: |
124+
# Authenticate with Snyk
125+
snyk auth ${{ secrets.SNYK_TOKEN }}
126+
127+
# Run snyk monitor to track dependencies
128+
snyk monitor --file=requirements.txt

0 commit comments

Comments
 (0)