-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (43 loc) · 1.27 KB
/
update-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
name: 'Update Requirements'
on:
push:
branches:
- main
paths:
- 'requirements.in'
pull_request:
branches:
- main
paths:
- 'requirements.in'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: |
set -eux
pip install pip-tools
pip-compile
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git checkout -b "requirements-$(date +%Y-%d-%m)"
git add .
(git commit -am "Update requirements.txt" && echo "changes=yes" >> $GITHUB_OUTPUT) || echo "changes=no" >> $GITHUB_OUTPUT
echo '```' >> $GITHUB_STEP_SUMMARY
git show >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
id: sync
name: Update requirements
- run: |
set -eux
git push -u origin "requirements-$(date +%Y-%d-%m)"
gh pr create --base main --fill
name: Open PR
if: steps.sync.outputs.changes == 'yes' && github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}