Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with error if default branch is not set in non prs #235

Merged
merged 2 commits into from Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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