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
5
5
6
6
if [ -n " $1 " ]; then
7
7
BRANCH=" $1 "
8
+ elif [ " $CI " != " true" ]; then
9
+ echo " Please specify a base branch in the command line"
10
+ exit 1
8
11
elif [ -n " $GITHUB_EVENT_BEFORE " ] && [ " push" = " $GITHUB_EVENT_NAME " ]; then
9
12
BRANCH=" $GITHUB_EVENT_BEFORE "
10
13
elif [ -n " $GITHUB_BASE_REF " ]; then
11
14
BRANCH=" origin/$GITHUB_BASE_REF "
12
- else
15
+ elif git symbolic-ref -q HEAD ; then # check if we're in a branch
13
16
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"
14
25
fi
15
26
16
27
MERGE_BASE=$( git merge-base $BRANCH HEAD)
You can’t perform that action at this time.
0 commit comments