Skip to content

Commit

Permalink
[OpenXLA-pin-update trigger] Create _openxla_pin_update_weekly.yml (#…
Browse files Browse the repository at this point in the history
…7108)

add trigger to create new OpenXLA-pin update PR automatically weekly, this is the first draft PR, and there maybe some follow-up change to update due the affect happen after PR merge
  • Loading branch information
ManfeiBai committed Aug 23, 2024
1 parent 64a1b7f commit 5f82da9
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/openxla_pin_update_weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Weekly Code Update PR
on:
workflow_dispatch: # Manual trigger
# schedule:
# - cron: '0 9 * * 1' # Each Monday 9:00AM (PDT time)

jobs:
update_and_create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- name: Create new branch
run: git checkout -b weekly-update-${{ env.CURRENT_DATE }}

- name: Install sed
run: sudo apt-get update && sudo apt-get install -y sed

- name: Get JAX version for specified date
run: |
# Here catch jax dev version with hard-code format, where _version is defined ever changes, this will break.
# Contributors who help to update OpenXLA-pin update please check line number here if the JAX version doesn't update.
version_line=$(curl -s https://raw.githubusercontent.com/google/jax/main/jax/version.py | sed -n '24p')
JAX_VERSION=$(echo "$version_line" | grep -oP '(?<=")[0-9.]+(?=")')
if [ -z "$JAX_VERSION" ]; then
echo "No JAX release found for ${{ env.CURRENT_DATE }}. Skipping update jax version in automatically status."
exit 0
fi
echo "JAX_VERSION=$JAX_VERSION" >> $GITHUB_ENV
- name: Update date in setup.py
run: |
sed -i "s/_date =.*/_date = '${{ env.CURRENT_DATE }}'/" setup.py
sed -i "s/_jax_version =.*/_jax_version = f'${{ env.JAX_VERSION }}.dev${{ env.CURRENT_DATE }}'/" setup.py
git add setup.py
- name: Fetch HEAD commit from OpenXLA github repo
run: |
echo "HEAD_COMMIT=$(git ls-remote https://github.com/openxla/xla.git HEAD | awk '{print $1}')" >> $GITHUB_ENV
- name: Update OpenXLA commit in WORKSPACE
run: |
sed -i "s/xla_hash =.*/xla_hash = '${{ env.HEAD_COMMIT }}'/" WORKSPACE
git add WORKSPACE
git commit -m "Weekly update WORKSPACE with (${{ env.HEAD_COMMIT }})"
git push origin HEAD
- name: Create Pull Request
uses: actions/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: weekly-update-${{ env.CURRENT_DATE }}
base: main
title: "Weekly Code Update - ${{ env.CURRENT_DATE }}"
body: "This PR contains the weekly OpenXLA-pin update at commit: (HEAD commit: ${{ env.HEAD_COMMIT }}), with libtpu version at ${{ env.CURRENT_DATE }}."
labels: tpuci


0 comments on commit 5f82da9

Please sign in to comment.