@@ -24,22 +24,25 @@ async function main() {
24
24
] ) ;
25
25
const currentAuthor = runSequence ( [
26
26
[ "git" , [ "log" , "-1" , `--pretty="%aN <%aE>"` ] ]
27
- ] )
27
+ ] ) ;
28
+ runSequence ( [
29
+ [ "git" , [ "fetch" , "origin" , "master" ] ]
30
+ ] ) ;
28
31
let logText = runSequence ( [
29
- [ "git" , [ "log" , `master..${ currentSha } ` , `--pretty="%h %s%n%b"` ] ]
32
+ [ "git" , [ "log" , `origin/ master..${ currentSha . trim ( ) } ` , `--pretty="%h %s%n%b"` ] ]
30
33
] ) ;
31
34
logText = `Cherry-pick PR #${ process . env . SOURCE_ISSUE } into ${ process . env . TARGET_BRANCH }
32
35
33
36
Component commits:
34
- ${ logText } `
37
+ ${ logText . trim ( ) } `
35
38
const logpath = path . join ( __dirname , "../" , "logmessage.txt" ) ;
36
39
runSequence ( [
37
40
[ "git" , [ "checkout" , "-b" , "temp-branch" ] ] ,
38
41
[ "git" , [ "reset" , "master" , "--soft" ] ]
39
42
] ) ;
40
43
fs . writeFileSync ( logpath , logText ) ;
41
44
runSequence ( [
42
- [ "git" , [ "commit" , "-F" , logpath , `--author="${ currentAuthor } "` ] ]
45
+ [ "git" , [ "commit" , "-F" , logpath , `--author="${ currentAuthor . trim ( ) } "` ] ]
43
46
] ) ;
44
47
fs . unlinkSync ( logpath ) ;
45
48
const squashSha = runSequence ( [
@@ -48,7 +51,7 @@ ${logText}`
48
51
runSequence ( [
49
52
[ "git" , [ "checkout" , process . env . TARGET_BRANCH ] ] , // checkout the target branch
50
53
[ "git" , [ "checkout" , "-b" , branchName ] ] , // create a new branch
51
- [ "git" , [ "cherry-pick" , squashSha ] ] , //
54
+ [ "git" , [ "cherry-pick" , squashSha . trim ( ) ] ] , //
52
55
[ "git" , [ "remote" , "add" , "fork" , remoteUrl ] ] , // Add the remote fork
53
56
[ "git" , [ "push" , "--set-upstream" , "fork" , branchName , "-f" ] ] // push the branch
54
57
] ) ;
0 commit comments