• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Create a cherry pick from a PR
2
3on:
4  repository_dispatch:
5    types: [try-cherry-pick]
6
7jobs:
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          token: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}
21
22      - name: Setup Python
23        uses: actions/setup-python@v4
24        with:
25          python-version: '3.11'
26          cache: pip
27
28      # Not the direct dependencies but the script uses trymerge
29      - run: pip install pyyaml==6.0 rockset==1.0.3
30
31      - name: Setup committer id
32        run: |
33          git config --global user.name "PyTorch Bot"
34          git config --global user.email "pytorchbot@users.noreply.github.com"
35
36      - name: Cherry pick the PR
37        shell: bash
38        env:
39          PR_NUM: ${{ github.event.client_payload.pr_num }}
40          BRANCH: ${{ github.event.client_payload.branch }}
41          CLASSIFICATION: ${{ github.event.client_payload.classification }}
42          FIXES: ${{ github.event.client_payload.fixes || '' }}
43          ACTOR: ${{ github.actor }}
44          GITHUB_TOKEN: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN }}
45        run: |
46          set -ex
47
48          python .github/scripts/cherry_pick.py \
49            --onto-branch "${BRANCH}" \
50            --classification "${CLASSIFICATION}" \
51            --fixes "${FIXES}" \
52            --github-actor "${ACTOR}" \
53            "${PR_NUM}"
54
55concurrency:
56  group: cherry-pick-pr-${{ github.event.client_payload.pr_num }}
57  cancel-in-progress: true
58