pytorch/.github/workflows/_update-commit-hash.yml
2023-04-08 01:13:05 +00:00

64 lines
2 KiB
YAML

name: update-commit-hash
on:
workflow_call:
inputs:
repo-owner:
required: false
type: string
description: Name of repository's owner.
default: pytorch
repo-name:
required: true
type: string
description: Name of the repository we're updating commit hash for.
branch:
required: true
type: string
description: Branch to fetch commit of
pin-folder:
type: string
description: Path to folder with commit pin
required: false
default: .github/ci_commit_pins
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-commit-hash:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: false
token: ${{ secrets.MERGEBOT_TOKEN }}
- name: Checkout
shell: bash
run: |
git clone https://github.com/${{ inputs.repo-owner }}/${{ inputs.repo-name }}.git --quiet
- name: Check if there already exists a PR
shell: bash
env:
REPO_NAME: ${{ inputs.repo-name }}
BRANCH: ${{ inputs.branch }}
PIN_FOLDER: ${{ inputs.pin-folder }}
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}" --pin-folder "${PIN_FOLDER}"