File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,23 @@ if [ -z "$PR_COMMITS" ]; then
5555 echo " PR $PR_NUMBER does not exist"
5656 exit 1
5757fi
58+ # Check PR does not contain merge commit
59+ echo " - Checking PR does not contain merge commit"
60+ for PR_COMMIT in $PR_COMMITS ; do
61+ PARENT_COUNT=$( git rev-list --parents -n 1 " $PR_COMMIT " | wc -w)
62+ if [ " $PARENT_COUNT " -gt 2 ]; then
63+ echo " PR $PR_NUMBER contains a merge commit: $PR_COMMIT "
64+ echo " Merge commit changes: https://github.com/DataDog/dd-trace-java/commit/${PR_COMMIT} "
65+ echo " PR commit list: https://github.com/DataDog/dd-trace-java/pull/${PR_NUMBER} /commits"
66+ echo -n " Would you like to cherry-pick the PR ${PR_NUMBER} merge commit instead of each of its commits individually? (y/n) "
67+ read -r ANSWER
68+ if [ " $ANSWER " == " y" ]; then
69+ PR_COMMITS=$( gh pr view " $PR_NUMBER " --json mergeCommit --jq ' .mergeCommit.oid' )
70+ else
71+ exit 1
72+ fi
73+ fi
74+ done
5875PR_TITLE=$( gh pr view " $PR_NUMBER " --json title --jq ' .title' )
5976PR_LABELS=$( gh pr view " $PR_NUMBER " --json labels --jq ' [.labels[].name] | join(",")' )
6077
You can’t perform that action at this time.
0 commit comments