-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenXLA-pin-update trigger] Create _openxla_pin_update_weekly.yml (#…
…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
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||
|
||
|