File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 44TARGET_BRANCH=" ${1:- main} "
55
66echo " Target branch: $TARGET_BRANCH "
7- git fetch origin $TARGET_BRANCH 2> /dev/null
7+ git fetch --no-tags --depth=1 origin $TARGET_BRANCH 2> /dev/null
8+ target_sha=$( git rev-parse origin/${TARGET_BRANCH} )
89
9- out=$( git log origin/${TARGET_BRANCH} ..HEAD --merges --oneline)
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=" $target_sha " origin " $GITHUB_HEAD_REF " 2> /dev/null
13+ tip=$( git rev-parse origin/$GITHUB_HEAD_REF )
14+ else
15+ tip=" HEAD"
16+ fi
17+
18+ out=$( git log ${target_sha} ..${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