mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
see https://docs.google.com/document/d/1jRT-on-v8bcTCHD8aGFH7IuCDR7JL37GlP6Z2EYgmyk/edit# add file with hash, add nightly job that makes a pr to update the hash, pr needs to be manually accepted (for now? maybe can get bot to approve it automatically later) Pull Request resolved: https://github.com/pytorch/pytorch/pull/77824 Approved by: https://github.com/janeyx99
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
name: Update xla commit hash
|
|
|
|
on:
|
|
schedule:
|
|
# Every day at 12:37am
|
|
# Choose a random time near midnight because it may be delayed if there are high loads
|
|
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
|
- cron: 37 0 * * *
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NEW_BRANCH_NAME: update-xla-commit-hash/${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
|
|
|
|
jobs:
|
|
update-xla-commit-hash:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
submodules: false
|
|
- name: Checkout xla
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/pytorch/xla.git --depth=1 --quiet
|
|
- name: Get new commit hash and update file
|
|
id: update-file
|
|
shell: bash
|
|
run: |
|
|
echo "::set-output name=original_commit::$(cat .github/xla_commit_hash.txt)"
|
|
pushd xla
|
|
git rev-parse master > ../.github/xla_commit_hash.txt
|
|
popd
|
|
if [[ $(git diff --exit-code .github/xla_commit_hash.txt) ]]; then
|
|
git checkout -b "${NEW_BRANCH_NAME}"
|
|
git config --global user.email "pytorchmergebot@users.noreply.github.com"
|
|
git config --global user.name "PyTorch MergeBot"
|
|
git add .github/xla_commit_hash.txt
|
|
git commit -m "update xla commit hash"
|
|
git push --set-upstream origin "${NEW_BRANCH_NAME}"
|
|
echo "::set-output name=new_commit::$(cat .github/xla_commit_hash.txt)"
|
|
fi
|
|
- name: Create Pull Request
|
|
uses: actions/github-script@v6
|
|
if: ${{ steps.update-file.outputs.new_commit }}
|
|
env:
|
|
ORIGINAL_COMMIT: ${{ steps.update-file.outputs.original_commit }}
|
|
NEW_COMMIT: ${{ steps.update-file.outputs.new_commit }}
|
|
with:
|
|
script: |
|
|
const { repo, owner } = context.repo;
|
|
const { NEW_BRANCH_NAME, NEW_COMMIT, ORIGINAL_COMMIT } = process.env
|
|
const result = await github.rest.pulls.create({
|
|
title: '[XLA hash update] update the pinned xla hash',
|
|
owner,
|
|
repo,
|
|
head: `${NEW_BRANCH_NAME}`,
|
|
base: 'master',
|
|
body: [
|
|
'This PR is auto-generated nightly by [this action](https://github.com/pytorch/pytorch/blob/master/.github/workflows/update-xla-commit-hash.yml).\n',
|
|
`Update the pinned xla hash from \`${ORIGINAL_COMMIT}\` to \`${NEW_COMMIT}\`.`
|
|
].join('')
|
|
});
|