Skip to content

Commit cf0ebe6

Browse files
committed
chore: auto cherry-pick by label (#9447)
(cherry picked from commit 262953f)
1 parent e58f8e2 commit cf0ebe6

5 files changed

Lines changed: 88 additions & 3 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Cherry Pick Auto
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
- release-*
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
13+
14+
jobs:
15+
cherry-pick:
16+
if: ${{ github.event.pull_request.merged == true && (github.base_ref == 'main' || startsWith(github.base_ref, 'release-')) }}
17+
uses: apecloud/apecloud-cd/.github/workflows/pull-request-cherry-pick-auto.yml@v0.1.88
18+
secrets: inherit
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Cherry Pick Label Check
2+
3+
on:
4+
pull_request_target:
5+
types: [ labeled, unlabeled, synchronize ]
6+
branches:
7+
- main
8+
- release-*
9+
10+
jobs:
11+
pr-label-check:
12+
uses: apecloud/apecloud-cd/.github/workflows/pull-request-label-check.yml@v0.1.88
13+
with:
14+
CHECK_LABEL: "pick"
15+
secrets: inherit
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Cherry Pick Usage
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
branches:
8+
- main
9+
- release-*
10+
11+
env:
12+
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
13+
14+
jobs:
15+
cherry-pick-usage:
16+
uses: apecloud/apecloud-cd/.github/workflows/pull-request-cherry-pick-usage.yml@v0.1.88
17+
secrets: inherit

.github/workflows/cherry-pick.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,37 @@ on:
33
issue_comment:
44
types: [created]
55

6+
env:
7+
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
68

79
jobs:
810
cherry-pick:
9-
name: Cherry Pick
1011
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick')
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4
1415
with:
15-
token: ${{ secrets.GITHUB_TOKEN }}
16+
token: ${{ env.GH_TOKEN }}
1617
fetch-depth: 0
1718

1819
- name: Automatic Cherry Pick
1920
uses: apecloud-inc/gha-cherry-pick@v1
2021
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GITHUB_TOKEN: ${{ env.GH_TOKEN }}
23+
24+
pick-meassge:
25+
needs: [ cherry-pick ]
26+
if: ${{ failure() || cancelled() }}
27+
uses: apecloud/apecloud-cd/.github/workflows/feishui-message.yml@v0.1.88
28+
with:
29+
TYPE: "5"
30+
BOT_TYPE: "specify"
31+
BOT_WEBHOOK: "${{ vars.CHERRY_PICK_BOT_WEBHOOK }}"
32+
CONTENT: " ${{ github.repository }} ${{ github.event.comment.body }} error"
33+
PR_NUMBER: "${{ github.event.issue.number }}"
34+
secrets: inherit
35+
36+
label-pick:
37+
if: ${{ github.event.issue.pull_request != '' && (contains(github.event.comment.body, '/pick') || contains(github.event.comment.body, '/nopick')) && ! contains(github.event.comment.body, 'Auto Cherry-pick Instructions') }}
38+
uses: apecloud/apecloud-cd/.github/workflows/pull-request-label-pick.yml@v0.1.88
39+
secrets: inherit
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Create Release Branch Message
2+
3+
on:
4+
create:
5+
6+
run-name: Create Release Branch
7+
8+
jobs:
9+
create-branch:
10+
if: startsWith(github.ref_name, 'release-')
11+
uses: apecloud/apecloud-cd/.github/workflows/feishui-message.yml@v0.1.94
12+
with:
13+
TYPE: "6"
14+
BOT_TYPE: "specify"
15+
BOT_WEBHOOK: "${{ vars.CHERRY_PICK_BOT_WEBHOOK }}"
16+
CONTENT: "${{ github.repository }} release branch [ ${{ github.ref_name }} ] was created!"
17+
secrets: inherit

0 commit comments

Comments
 (0)