-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.74 KB
/
update.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
name: update
on:
pull_request:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pru
- name: Determine current branch
id: current_branch
run: echo "CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Run requirements updater script
id: run_pru
run: |
bash .github/scripts/update_requirements.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
if: steps.run_pru.outputs.updated == 'true'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Create new branch
if: steps.run_pru.outputs.updated == 'true'
run: |
BRANCH_NAME="update-requirements-${GITHUB_RUN_ID}"
git checkout -b $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "DATE=${{ steps.run_pru.outputs.update_date }}" >> $GITHUB_ENV
- name: Commit changes
if: steps.run_pru.outputs.updated == 'true'
run: |
git add .
git commit -m "Update requirements based on failed tests at $DATE"
env:
DATE: ${{ steps.run_pru.outputs.update_date }}
- name: Push changes
if: steps.run_pru.outputs.updated == 'true'
run: |
git push origin $BRANCH_NAME
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}