Skip to content

Commit 56b3349

Browse files
authored
Created a workflow to update requirements file
1 parent 36acd9d commit 56b3349

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

.github/workflows/update-reqs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Update requirements.txt
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
update-reqs:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.12'
20+
21+
- name: Install pipreqs
22+
run: pip install pipreqs
23+
24+
- name: Update requirements.txt
25+
run: pipreqs . --force --ignore .venv
26+
27+
- name: Commit and push if changed
28+
run: |
29+
git config --global user.name "github-actions[bot]"
30+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
31+
git add requirements.txt
32+
if git diff --cached --quiet; then
33+
echo "No changes in requirements.txt"
34+
else
35+
git commit -m "Updated requirements.txt"
36+
git push
37+
fi

0 commit comments

Comments
 (0)