pytorch/.github/workflows/cherry-pick.yml

58 lines
1.8 KiB
YAML

name: Create a cherry pick from a PR
on:
repository_dispatch:
types: [try-cherry-pick]
jobs:
cherry-pick:
name: cherry-pick-pr-${{ github.event.client_payload.pr_num }}
runs-on: ubuntu-latest
environment: cherry-pick-bot
env:
GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
steps:
- name: Checkout repo
id: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
cache: pip
# Not the direct dependencies but the script uses trymerge
- run: pip install pyyaml==6.0.2
- name: Setup committer id
run: |
git config --global user.name "PyTorch Bot"
git config --global user.email "pytorchbot@users.noreply.github.com"
- name: Cherry pick the PR
shell: bash
env:
PR_NUM: ${{ github.event.client_payload.pr_num }}
BRANCH: ${{ github.event.client_payload.branch }}
CLASSIFICATION: ${{ github.event.client_payload.classification }}
FIXES: ${{ github.event.client_payload.fixes || '' }}
ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}
run: |
set -ex
python .github/scripts/cherry_pick.py \
--onto-branch "${BRANCH}" \
--classification "${CLASSIFICATION}" \
--fixes "${FIXES}" \
--github-actor "${ACTOR}" \
"${PR_NUM}"
concurrency:
group: cherry-pick-pr-${{ github.event.client_payload.pr_num }}
cancel-in-progress: true