summaryrefslogtreecommitdiffstats
path: root/.github/workflows/cherry_pick.yml
blob: 2947a8aabdb21a25ac4541087fa594043ab2c2d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Cherry-pick
on:
  workflow_dispatch:
    inputs:
      commit_sha:
        type: string
        description: Commit to get scripts
        default: ""
      commits:
        type: string
        default: ""
        description: |
          List of commits to cherry-pick. 
          Can be represented as full or short commit SHA, PR number or URL to commit or PR.
          Separated by space, comma or line end.
          Example: "sha5682 123245"
        required: true
      target_branches:
        default: ""
        description: Comma or space separated branches to cherry-pick
        required: true

env:
  GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
jobs:
  create-pr:
    runs-on: [self-hosted, tiny-worker]
    steps:
      - name: checkout
        uses: actions/checkout@v5
        with:
          fetch-depth: 1
          ref: ${{ inputs.commit_sha }}
          sparse-checkout: |
            .github
      - name: install packages
        shell: bash
        run: |
          pip install PyGithub==2.5.0

      - name: configure
        shell: bash
        run: |
            git config --global user.name YDBot
            git config --global user.email [email protected]
            git config --local github.token ${{ env.GH_TOKEN }}

      - name: run-command
        shell: bash
        env:
          REPO: ${{ github.repository }}
          TOKEN: ${{ env.GH_TOKEN }}
          GITHUB_STEP_SUMMARY: ${{ env.GITHUB_STEP_SUMMARY }}
        run: |
          ./.github/scripts/cherry_pick.py \
            --commits="${{ inputs.commits }}" \
            --target-branches="${{ inputs.target_branches }}"