@@ -24,22 +24,25 @@ async function main() {
2424 ] ) ;
2525 const currentAuthor = runSequence ( [
2626 [ "git" , [ "log" , "-1" , `--pretty="%aN <%aE>"` ] ]
27- ] )
27+ ] ) ;
28+ runSequence ( [
29+ [ "git" , [ "fetch" , "origin" , "master" ] ]
30+ ] ) ;
2831 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"` ] ]
3033 ] ) ;
3134 logText = `Cherry-pick PR #${ process . env . SOURCE_ISSUE } into ${ process . env . TARGET_BRANCH }
3235
3336Component commits:
34- ${ logText } `
37+ ${ logText . trim ( ) } `
3538 const logpath = path . join ( __dirname , "../" , "logmessage.txt" ) ;
3639 runSequence ( [
3740 [ "git" , [ "checkout" , "-b" , "temp-branch" ] ] ,
3841 [ "git" , [ "reset" , "master" , "--soft" ] ]
3942 ] ) ;
4043 fs . writeFileSync ( logpath , logText ) ;
4144 runSequence ( [
42- [ "git" , [ "commit" , "-F" , logpath , `--author="${ currentAuthor } "` ] ]
45+ [ "git" , [ "commit" , "-F" , logpath , `--author="${ currentAuthor . trim ( ) } "` ] ]
4346 ] ) ;
4447 fs . unlinkSync ( logpath ) ;
4548 const squashSha = runSequence ( [
@@ -48,7 +51,7 @@ ${logText}`
4851 runSequence ( [
4952 [ "git" , [ "checkout" , process . env . TARGET_BRANCH ] ] , // checkout the target branch
5053 [ "git" , [ "checkout" , "-b" , branchName ] ] , // create a new branch
51- [ "git" , [ "cherry-pick" , squashSha ] ] , //
54+ [ "git" , [ "cherry-pick" , squashSha . trim ( ) ] ] , //
5255 [ "git" , [ "remote" , "add" , "fork" , remoteUrl ] ] , // Add the remote fork
5356 [ "git" , [ "push" , "--set-upstream" , "fork" , branchName , "-f" ] ] // push the branch
5457 ] ) ;
0 commit comments