-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.49 KB
/
generate-requirements.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
name: Generate requirements files
on:
push:
paths:
- 'pyproject.toml'
- 'poetry.lock'
pull_request:
paths:
- 'pyproject.toml'
- 'poetry.lock'
workflow_dispatch:
jobs:
update-requirements:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
poetry --version
- name: Install dependencies
run: poetry install
- name: Install poetry-plugin-export
run: poetry self add poetry-plugin-export
- name: Export requirements.txt
run: poetry export --without-hashes -f requirements.txt --output requirements.txt
- name: Export dev-requirements.txt
run: poetry export --without-hashes --with dev -f requirements.txt --output dev-requirements.txt
- name: Check for changes
id: check_changes
run: |
git add requirements.txt dev-requirements.txt
git diff --cached --exit-code || echo "Changes detected" > changes_detected.txt
- name: Commit and Push changes
if: steps.check_changes.outputs.changes_detected
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "Update requirements files"
git push