Skip to content

Commit 864a827

Browse files
Generate requirements.txt on the fly in the snyk workflow
1 parent fc7c0de commit 864a827

File tree

3 files changed

+11
-34
lines changed

3 files changed

+11
-34
lines changed

.github/workflows/snyk.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
schedule:
44
- cron: "0 10 * * 1" # Monday @ 10am UTC
55
workflow_dispatch:
6+
push:
7+
paths:
8+
- pyproject.toml
9+
- '.github/workflows/snyk.yml'
610

711
env:
812
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
@@ -12,33 +16,17 @@ jobs:
1216
snyk-monitor:
1317
runs-on: ubuntu-latest
1418
steps:
15-
- uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
18-
19-
# - name: Run Snyk (setup.py)
20-
# uses: snyk/actions/python@master
21-
# with:
22-
# command: monitor
23-
# args: --file=setup.py --package-manager=pip --project-name=setup.py --org=${{ env.SNYK_ORG }}
19+
- uses: actions/checkout@v4
2420

25-
# - name: Run Snyk (requirements.txt)
26-
# uses: snyk/actions/python@master
27-
# with:
28-
# command: monitor
29-
# args: --file=requirements.txt --package-manager=pip --project-name=requirements.txt --org=${{ env.SNYK_ORG }}
30-
31-
# On Oct 2 2023, the steps using snyk/actions/python@master started failing with "undefined".
32-
# Nothing obvious changed in our code or in the Snyk action or Docker image.
33-
# Setting up and running snyk generically seems to work, so we'll go with that.
34-
- name: Set up Python
35-
uses: actions/setup-python@v4
21+
- name: Set up uv and Python
22+
uses: astral-sh/setup-uv@v6
3623
with:
3724
python-version: '3.11'
38-
- name: Install dependencies
25+
26+
- name: Prepare requirements.txt
3927
run: |
40-
python -m pip install --upgrade pip
41-
pip install -r requirements.txt
28+
uv pip compile pyproject.toml --output-file requirements.txt
29+
uv pip install -r requirements.txt
4230
4331
- uses: snyk/actions/setup@master
4432

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ license = { file = "LICENSE.md" }
77
readme = { file = "README.md", content-type = "text/markdown" }
88
requires-python = ">=3.8"
99

10-
# If you edit these, please also update requirements.txt
1110
dependencies = [
1211
"typing-extensions>=4.8.0",
1312
"pip>=10.0.0",

requirements.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)