-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (98 loc) · 3.08 KB
/
constraints.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Requirements
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
- epic/*
- "[0-9]+.[0-9]+.x"
paths:
- "**/requirements.in"
- "**/requirements.txt"
- .pre-commit-config.yaml
workflow_dispatch:
jobs:
pip-constraints:
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
name: Update pip constraints
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: hynek/setup-cached-uv@v2
- run: pip install tox uv -c requirements.txt
- run: tox -e update
- uses: actions/upload-artifact@v4
with:
name: pip-constraints
path: |
binder/requirements.txt
requirements.txt
pre-commit:
name: pre-commit autoupdate
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ComPWA/update-pre-commit@main
push:
name: Push changes
runs-on: ubuntu-22.04
needs:
- pip-constraints
- pre-commit
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifact
- run: ls -A
- name: Move artifacts to correct location
run: |
if [[ -d artifact ]]; then
cd artifact
ls -A
for path in .pre-commit-config.yaml requirements.txt binder/requirements.txt; do
[[ -f $path ]] && mv -f $path ../$path
done
fi
- run: git status -s
- name: Commit and push changes
if: github.event_name == 'pull_request'
run: |
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}
git config --global user.name "GitHub"
git config --global user.email "[email protected]"
git checkout -b ${{ github.head_ref }}
if [[ $(git status -s) ]]; then
git add -A
git commit -m "MAINT: update pip constraints and pre-commit"
git config pull.rebase true
git pull origin ${{ github.head_ref }}
git push origin HEAD:${{ github.head_ref }}
fi
- name: Create Pull Request
if: >-
github.event_name == 'workflow_dispatch'
uses: peter-evans/create-pull-request@v6
with:
commit-message: "MAINT: update pip constraints and pre-commit"
committer: GitHub <[email protected]>
author: GitHub <[email protected]>
title: "MAINT: update pip constraints and pre-commit"
labels: |
🔨 Maintenance
branch-suffix: timestamp
delete-branch: true
token: ${{ secrets.PAT }}