pytorch/.github/workflows/_update-commit-hash.yml
Catherine Lee 514bf9fecb automate hash pinning (#79470)
automate the pr approval and merging of hash pinning
also switch to a python script for easier control flow
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79470
Approved by: https://github.com/seemethere
2022-06-17 18:22:15 +00:00

53 lines
1.7 KiB
YAML

name: update-commit-hash
on:
workflow_call:
inputs:
repo-name:
required: true
type: string
description: Name of the repository we're updating commit hash for. Must be in pytorch org.
branch:
required: true
type: string
description: Branch to fetch commit of
secrets:
MERGEBOT_TOKEN:
required: true
description: Permissions for opening PR
PYTORCHBOT_TOKEN:
required: true
description: Permissions for approving PR
env:
NEW_BRANCH_NAME: update-${{ inputs.repo-name }}-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
token: ${{ secrets.MERGEBOT_TOKEN }}
- name: Checkout
shell: bash
run: |
git clone https://github.com/pytorch/${{ inputs.repo-name }}.git --depth=1 --quiet
- name: Check if there already exists a PR
shell: bash
env:
REPO_NAME: ${{ inputs.repo-name }}
BRANCH: ${{ inputs.branch }}
MERGEBOT_TOKEN: ${{ secrets.MERGEBOT_TOKEN }}
PYTORCHBOT_TOKEN: ${{ secrets.PYTORCHBOT_TOKEN }}
run: |
# put this here instead of the script to prevent accidentally changing the config when running the script locally
git config --global user.name "PyTorch MergeBot"
git config --global user.email "pytorchmergebot@users.noreply.github.com"
python .github/scripts/update_commit_hashes.py --repo-name "${REPO_NAME}" --branch "${BRANCH}"