-
Notifications
You must be signed in to change notification settings - Fork 5
45 lines (36 loc) · 1.19 KB
/
static.yaml
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
name: Update Requirements
on:
push:
branches:
- main
pull_request:
jobs:
update-requirements:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install pipreqs
run: pip install pipreqs
- name: Generate requirements.txt
run: pipreqs . --force
- name: Check for changes in requirements.txt
id: requirements_changed
run: |
git diff --exit-code requirements.txt || echo "requirements_changed=true" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: steps.requirements_changed.outputs.requirements_changed == 'true'
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add requirements.txt
git commit -m "Update requirements.txt"
git push https://${PAT_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref }}
- name: Check dependencies availability
run: pip install --no-cache-dir -r requirements.txt