11name : " Cherry-pick dependencies to release branch"
22on :
3- issue_comment :
4- types :
5- - created
3+ pull_request :
4+ branches :
5+ - main
6+ types : ["closed"]
67
78permissions :
89 contents : read
@@ -14,42 +15,23 @@ jobs:
1415 pull-requests : write
1516 runs-on : ubuntu-22.04
1617 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 }}
1819 steps :
1920 - name : Checkout
2021 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2122 with :
2223 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 }}
3525
3626 - name : Set release branch variable
3727 id : branch
38- env :
39- comment_body : ${{ github.event.comment.body }}
4028 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
5033
5134 - name : Cherry pick into ${{ steps.branch.outputs.branch }}
52- if : ${{ steps.branch.outputs.branch }}
5335 uses : carloscastrojumo/github-cherry-pick-action@503773289f4a459069c832dc628826685b75b4b3 # v1.0.10
5436 with :
5537 branch : ${{ steps.branch.outputs.branch }}
0 commit comments