|
| 1 | +name: Create a cherry pick from a PR |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [try-cherry-pick] |
| 6 | + |
| 7 | +jobs: |
| 8 | + cherry-pick: |
| 9 | + name: cherry-pick-pr-${{ github.event.client_payload.pr_num }} |
| 10 | + runs-on: ubuntu-latest |
| 11 | + environment: cherry-pick-bot |
| 12 | + env: |
| 13 | + GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 14 | + steps: |
| 15 | + - name: Checkout repo |
| 16 | + id: checkout |
| 17 | + uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + submodules: true |
| 21 | + token: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }} |
| 22 | + |
| 23 | + - name: Setup Python |
| 24 | + uses: actions/setup-python@v4 |
| 25 | + with: |
| 26 | + python-version: '3.10' |
| 27 | + cache: pip |
| 28 | + |
| 29 | + # Not the direct dependencies but the script uses trymerge |
| 30 | + - run: pip install pyyaml==6.0 rockset==1.0.3 |
| 31 | + |
| 32 | + - name: Setup committer id |
| 33 | + run: | |
| 34 | + git config --global user.name "PyTorch Bot" |
| 35 | + git config --global user.email "[email protected]" |
| 36 | +
|
| 37 | + - name: Cherry pick the PR |
| 38 | + shell: bash |
| 39 | + env: |
| 40 | + PR_NUM: ${{ github.event.client_payload.pr_num }} |
| 41 | + BRANCH: ${{ github.event.client_payload.branch }} |
| 42 | + CLASSIFICATION: ${{ github.event.client_payload.classification }} |
| 43 | + FIXES: ${{ github.event.client_payload.fixes || '' }} |
| 44 | + ACTOR: ${{ github.actor }} |
| 45 | + GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }} |
| 46 | + run: | |
| 47 | + set -ex |
| 48 | +
|
| 49 | + python ./third-party/pytorch/.github/scripts/cherry_pick.py \ |
| 50 | + --onto-branch "${BRANCH}" \ |
| 51 | + --classification "${CLASSIFICATION}" \ |
| 52 | + --fixes "${FIXES}" \ |
| 53 | + --github-actor "${ACTOR}" \ |
| 54 | + "${PR_NUM}" |
| 55 | +
|
| 56 | +concurrency: |
| 57 | + group: cherry-pick-pr-${{ github.event.client_payload.pr_num }} |
| 58 | + cancel-in-progress: true |
0 commit comments