File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,9 +66,18 @@ node('linux') {
6666 go_repo = readFile(' tmp/GO_LIST' ). trim()
6767
6868 if (git_branch != " remotes/origin/master" ) {
69- // HACK: get actual PR commit (https://github.com/deis/controller-sdk-go/issues/45)
70- sh ' git rev-parse HEAD | git log --pretty=%P -n 1 | cut -c1-40 > tmp/ACTUAL_COMMIT'
71- git_commit = readFile(' tmp/ACTUAL_COMMIT' ). trim()
69+ // Determine actual PR commit, if necessary
70+ sh ' git rev-parse HEAD | git log --pretty=%P -n 1 --date-order > tmp/MERGE_COMMIT_PARENTS'
71+ sh ' cat tmp/MERGE_COMMIT_PARENTS'
72+ merge_commit_parents = readFile(' tmp/MERGE_COMMIT_PARENTS' ). trim()
73+ if (merge_commit_parents. length() > 40 ) {
74+ echo ' More than one merge commit parent signifies that the merge commit is not the PR commit'
75+ echo " Changing git_commit from '${ git_commit} ' to '${ merge_commit_parents.take(40)} '"
76+ git_commit = merge_commit_parents. take(40 )
77+ } else {
78+ echo ' Only one merge commit parent signifies that the merge commit is also the PR commit'
79+ echo " Keeping git_commit as '${ git_commit} '"
80+ }
7281 // convert 'github.com/deis/controller-sdk-go' to 'github.com/${env.CHANGE_AUTHOR}/controller-sdk-go'
7382 go_repo = go_repo. replace(' deis' , env. CHANGE_AUTHOR )
7483 }
You can’t perform that action at this time.
0 commit comments