File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,26 @@ TARGET_BRANCH="${1:-main}"
66echo " Target branch: $TARGET_BRANCH "
77git fetch origin $TARGET_BRANCH 2> /dev/null
88
9- out=$( git log origin/${TARGET_BRANCH} ..HEAD --merges --oneline)
9+
10+ # If in a github PR, base from tip of branch, not the merge commit
11+ if [ -n " $GITHUB_HEAD_REF " ]; then
12+ git fetch --no-tags --shallow-exclude=" origin/${TARGET_BRANCH} " origin " $GITHUB_HEAD_REF "
13+ tip=" $( git rev-parse origin/$GITHUB_HEAD_REF ) "
14+ else
15+ tip=" HEAD"
16+ fi
17+
18+ out=$( git log origin/${TARGET_BRANCH} ..${tip} --merges --oneline)
1019exit_status=$?
20+
1121if [ -n " $out " ]
1222then
1323 echo " Please rebase your branch" >&2
1424 echo " If your branch or its base branch is a release branch then ignore this error" >&2
15- echo " \nMerge commit(s):" >&2
25+ echo >&2
26+ echo " Merge commit(s):" >&2
1627 echo " $out " >&2
1728 # Disclaimer: current version of the check doesn't work well with release branches
1829 exit_status=1
1930fi
20-
2131exit ${exit_status}
You can’t perform that action at this time.
0 commit comments