File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ name: Automatically cherry-pick commit
2
2
3
3
on :
4
4
workflow_call :
5
+ inputs :
6
+ autoCherryPickToken :
7
+ description : ' The sub-string in the commit message to determine that commit has to be cherry-picked'
8
+ required : false
9
+ default : Auto-cherry-pick to
10
+ type : string
5
11
6
12
secrets :
7
13
GH_ACTIONS_REPO_TOKEN :
13
19
jobs :
14
20
cherry-pick :
15
21
runs-on : ubuntu-latest
16
- if : contains(github.event.head_commit.message, 'Auto-cherry-pick to' )
22
+ if : contains(github.event.head_commit.message, inputs.autoCherryPickToken )
17
23
steps :
18
24
19
25
- uses : actions/checkout@v4
20
26
with :
21
27
token : ${{ env.GITHUB_TOKEN }}
22
28
show-progress : false
29
+ fetch-depth : 0
23
30
24
31
- name : Cherry-pick to branches in commit message
25
32
run : |
26
33
git config --global user.name 'Spring Builds'
27
34
git config --global user.email 'builds@springframework.org'
28
- branches=$(echo '${{ github.event.head_commit.message }}' | grep 'Auto-cherry-pick to' | grep -o1 -E "([0-9]+\.[0-9]+\.x)")
29
- branchCommitMessage=$(echo '${{ github.event.head_commit.message }}' | grep -v 'Auto-cherry-pick to')
35
+ cherryPickToken=${{ inputs.autoCherryPickToken }}
36
+ commitMessage=${{ github.event.head_commit.message }}
37
+ branches=$(echo '$commitMessage' | grep '$cherryPickToken' | grep -o1 -E "([0-9]+\.[0-9]+\.x)")
38
+ branchCommitMessage=$(echo '$commitMessage' | grep -v '$cherryPickToken')
30
39
for branch in $branches
31
40
do
32
41
git checkout $branch
38
47
exit 1
39
48
fi
40
49
git commit –amend -m $branchCommitMessage
41
- git push origin $branch
50
+ git push $branch
42
51
done
You can’t perform that action at this time.
0 commit comments