1
1
name : " Cherry-pick dependencies to release branch"
2
2
on :
3
- pull_request :
4
- branches :
5
- - main
6
- types : ["closed"]
3
+ issue_comment :
4
+ types :
5
+ - created
7
6
8
7
permissions :
9
8
contents : read
@@ -15,23 +14,42 @@ jobs:
15
14
pull-requests : write
16
15
runs-on : ubuntu-22.04
17
16
name : Cherry pick into release branch
18
- if : ${{ (contains( github.event.pull_request.labels.*.name, 'dependencies') || contains(github.event. pull_request.labels.*.name, 'needs cherry pick')) && github.event.pull_request.merged == true }}
17
+ if : ${{ github.event.issue. pull_request.merged_at != null }}
19
18
steps :
20
19
- name : Checkout
21
20
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22
21
with :
23
22
fetch-depth : 0
24
- token : ${{ secrets.NGINX_PAT }}
23
+
24
+ - name : Check if Actor is a Member of one of the teams
25
+ uses : im-open/is-actor-team-member@6633b6e4d9bd2a6917f976b14c64626902e13805 # v1.2.0
26
+ with :
27
+ github-actor : ${{ github.actor }}
28
+ github-organization : ${{ github.repository_owner}}
29
+ github-team-slugs : |
30
+ [
31
+ "kic",
32
+ "nginx-docs"
33
+ ]
34
+ github-token : ${{ secrets.NGINX_PAT }}
25
35
26
36
- name : Set release branch variable
27
37
id : branch
38
+ env :
39
+ comment_body : ${{ github.event.comment.body }}
28
40
run : |
29
- branch=$(git branch -a | egrep '^\s+remotes/origin/release' | awk '{print $1}' | sort -u | tail -n 1)
30
- release_branch=$(basename ${branch})
31
- echo "branch=${release_branch}" >> $GITHUB_OUTPUT
32
- cat $GITHUB_OUTPUT
41
+ regex="/cherry-pick to (release-[2-9]+\.[0-9]+)"
42
+ if [[ "${comment_body}" =~ $regex ]]; then
43
+ branch=${BASH_REMATCH[1]}
44
+ if git branch -a | egrep '^\s+remotes/origin/release' | grep -q "${branch}"; then
45
+ echo "branch=${branch}" >> $GITHUB_OUTPUT
46
+ else
47
+ echo "branch=" >> $GITHUB_OUTPUT
48
+ fi
49
+ fi
33
50
34
51
- name : Cherry pick into ${{ steps.branch.outputs.branch }}
52
+ if : ${{ steps.branch.outputs.branch }}
35
53
uses : carloscastrojumo/github-cherry-pick-action@503773289f4a459069c832dc628826685b75b4b3 # v1.0.10
36
54
with :
37
55
branch : ${{ steps.branch.outputs.branch }}
0 commit comments