Skip to content

Commit 2c9e17c

Browse files
authored
Exit with error if default branch is not set in non prs (#235)
1 parent 39d8e88 commit 2c9e17c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ then
125125
exit 0
126126
fi
127127

128+
# sanitize that the default_branch is set (via env var when running on PRs) else find it natively
129+
if [ -z "${default_branch}" ]
130+
then
131+
echo "The DEFAULT_BRANCH should be autodetected when tag-action runs on on PRs else must be defined, See: https://github.com/anothrNick/github-tag-action/pull/230, since is not defined we find it natively"
132+
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
133+
echo "default_branch=${default_branch}"
134+
# re check this
135+
if [ -z "${default_branch}" ]
136+
then
137+
echo "::error::DEFAULT_BRANCH must not be null, something has gone wrong."
138+
exit 1
139+
fi
140+
fi
141+
128142
# get the merge commit message looking for #bumps
129143
declare -A history_type=(
130144
["last"]="$(git show -s --format=%B)" \

0 commit comments

Comments
 (0)