-
Notifications
You must be signed in to change notification settings - Fork 16
76 lines (67 loc) · 2.52 KB
/
roll_nightly_deps.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
name: Roll nightly deps
on:
workflow_dispatch:
schedule:
# Do the nightly dep roll at 12:30 PDT.
- cron: '30 19 * * *'
concurrency:
group: roll_deps
permissions:
# Allows approval.
pull-requests: write
jobs:
roll_deps:
runs-on: ubuntu-20.04
steps:
- name: Checking out repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
# Always checkout main, even if invoked from a branch for dev use.
ref: main
token: ${{ secrets.WRITE_ACCESS_TOKEN }}
fetch-depth: 0
- name: "Setting up Python"
uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # v2.3.3
with:
python-version: "3.10"
- name: "Install openxla-dev-tools"
run: |
pip install git+https://github.com/openxla/openxla-devtools.git
- name: "Check out workspace"
run: |
# GitHub's actions/checkout has super-powers when it comes to tokens
# and write access, so we bootstrap with that. Then initialize the
# workspace one level up.
cd ..
openxla-workspace init
# We presently do not need deps or submodules to bump versions.
openxla-workspace checkout --ro --no-submodules --no-deps openxla-pjrt-plugin
- name: "Roll dependencies"
run: |
openxla-workspace roll nightly
- name: "Create pull request"
env:
GH_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }}
APPROVAL_TOKEN: ${{ github.token }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "OpenXLA Dep Roller"
status="$(git status --porcelain)"
if [ -z "$status" ]; then
echo "No updates made"
else
echo "Dependencies updated"
git diff
branch="roll_nightly_${{ github.run_number }}"
git add -A
git checkout -b "$branch"
git commit -m "Update nightly dependencies"
git push origin "HEAD:$branch"
pr="$(gh pr create --base main --head "$branch" --title "Update nightly dependencies" --body "Automatically created")"
echo "Created pull request $pr"
gh pr merge $pr --auto --delete-branch --squash
# Can't approve your own PR, so approve with the github actions bot.
echo "Approving PR"
export GH_TOKEN="$APPROVAL_TOKEN"
gh pr review $pr -a
fi