1
1
name : " Cherry-pick dependencies to release branch"
2
2
on :
3
- issue_comment :
4
- types :
5
- - created
3
+ pull_request :
4
+ branches :
5
+ - main
6
+ types : ["closed"]
6
7
7
8
permissions :
8
9
contents : read
@@ -14,42 +15,23 @@ jobs:
14
15
pull-requests : write
15
16
runs-on : ubuntu-22.04
16
17
name : Cherry pick into release branch
17
- if : ${{ github.event.issue. pull_request.merged_at != null }}
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 }}
18
19
steps :
19
20
- name : Checkout
20
21
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21
22
with :
22
23
fetch-depth : 0
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 }}
24
+ token : ${{ secrets.NGINX_PAT }}
35
25
36
26
- name : Set release branch variable
37
27
id : branch
38
- env :
39
- comment_body : ${{ github.event.comment.body }}
40
28
run : |
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
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
50
33
51
34
- name : Cherry pick into ${{ steps.branch.outputs.branch }}
52
- if : ${{ steps.branch.outputs.branch }}
53
35
uses : carloscastrojumo/github-cherry-pick-action@503773289f4a459069c832dc628826685b75b4b3 # v1.0.10
54
36
with :
55
37
branch : ${{ steps.branch.outputs.branch }}
0 commit comments