Skip to content

Commit

Permalink
Exit with error if default branch is not set in non prs (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbe-arg committed Jan 5, 2023
1 parent 39d8e88 commit 2c9e17c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions entrypoint.sh
Expand Up @@ -125,6 +125,20 @@ then
exit 0
fi

# sanitize that the default_branch is set (via env var when running on PRs) else find it natively
if [ -z "${default_branch}" ]
then
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"
default_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
echo "default_branch=${default_branch}"
# re check this
if [ -z "${default_branch}" ]
then
echo "::error::DEFAULT_BRANCH must not be null, something has gone wrong."
exit 1
fi
fi

# get the merge commit message looking for #bumps
declare -A history_type=(
["last"]="$(git show -s --format=%B)" \
Expand Down

0 comments on commit 2c9e17c

Please sign in to comment.