This repository has been archived by the owner on Jun 27, 2024. It is now read-only.
Roll nightly deps #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Roll nightly deps | |
on: | |
workflow_dispatch: | |
schedule: | |
# Do the nightly dep roll at 13:30 PDT. | |
- cron: '30 20 * * *' | |
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 | |
submodules: true | |
- 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 openxla-nvgpu | |
- name: "Roll dependencies" | |
run: | | |
openxla-workspace roll nightly | |
# Don't need submodules but do need repos in order to show pretty | |
# update description. | |
openxla-workspace sync --exclude-submodule=".*" | |
- name: "Create pull request" | |
env: | |
GH_TOKEN: ${{ secrets.WRITE_ACCESS_TOKEN }} | |
APPROVAL_TOKEN: ${{ github.token }} | |
run: | | |
git config --local user.email "iree-github-actions-bot@google.com" | |
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" | |
body="$(openxla-workspace show-pins)" | |
pr="$(gh pr create --base main --head "$branch" --title "Update nightly dependencies" --body "$body")" | |
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 |