File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,23 @@ set -o pipefail
55
66if [ -n " $1 " ]; then
77 BRANCH=" $1 "
8+ elif [ " $CI " != " true" ]; then
9+ echo " Please specify a base branch in the command line"
10+ exit 1
811elif [ -n " $GITHUB_EVENT_BEFORE " ] && [ " push" = " $GITHUB_EVENT_NAME " ]; then
912 BRANCH=" $GITHUB_EVENT_BEFORE "
1013elif [ -n " $GITHUB_BASE_REF " ]; then
1114 BRANCH=" origin/$GITHUB_BASE_REF "
12- else
15+ elif git symbolic-ref -q HEAD ; then # check if we're in a branch
1316 BRANCH=" @{upstream}"
17+ else
18+ # in a detached HEAD.
19+ # default to origin/main, this is a "last resort" to make this script do the
20+ # right thing, and is only really here so it works when pushing a new branch,
21+ # with the caveat that it assumes the base branch to be called "main".
22+ # (this has been the case with wabt for a while. may fail if the repo lacks a
23+ # "main" branch for some reason.)
24+ BRANCH=" origin/main"
1425fi
1526
1627MERGE_BASE=$( git merge-base $BRANCH HEAD)
You can’t perform that action at this time.
0 commit comments