Skip to content

Commit f0d7c83

Browse files
committed
feat: add branch checks
1 parent bda440d commit f0d7c83

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

autotag

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ checks() {
2828
echo '🛑 Commit is already tagged - aborting.'
2929
exit 1
3030
fi
31+
32+
local BRANCH=$(git branch --show-current)
33+
34+
if [[ -z "$BRANCH" ]]; then
35+
echo '🛑 You appear to be checked out on a commit or tag. Please check out a branch.'
36+
exit 1
37+
fi
38+
39+
if [[ ! "$BRANCH" =~ "$ALLOWED_BRANCHES" ]]; then
40+
echo "🛑 You appear to be on a feature branch. Please check out your repo's default branch"
41+
echo "Allowed branches are: $ALLOWED_BRANCHES"
42+
exit 1
43+
fi
3144
}
3245

3346
if [[ "$#" -eq 0 ]] || [[ "$1" == '-h' ]] || [[ "$1" == '--help' ]]; then

0 commit comments

Comments
 (0)