Skip to content

Commit

Permalink
🔄 synced file(s) with kubecub/go-project-layout
Browse files Browse the repository at this point in the history
🤖 kubbot to synchronize the warehouse
  • Loading branch information
kubbot committed Jun 28, 2023
1 parent d5097a8 commit 636355f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#
# ==============================================================================

LC_ALL=C

local_branch="$(git rev-parse --abbrev-ref HEAD)"
valid_branch_regex="^(main|master|develop)$|(feature|feat|release|hotfix|test|bug|ci|style|)\/[a-z0-9._-]+$|^HEAD$"


YELLOW="\e[93m"
GREEN="\e[32m"
Expand Down Expand Up @@ -87,4 +92,12 @@ then
printMessage "If you really need to commit this file, you can override the size limit by setting the GIT_FILE_SIZE_LIMIT environment variable, e.g. GIT_FILE_SIZE_LIMIT=42000000 for 42MB. Or, commit with the --no-verify switch to skip the check entirely."
printError "Commit aborted"
exit 1;
fi

if [[ ! $local_branch =~ $valid_branch_regex ]]
then
printError "There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex.
Your commit will be rejected. You should rename your branch to a valid name(feat/name OR bug/name) and try again."
printError "For more on this, read on: https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694"
exit 1
fi

0 comments on commit 636355f

Please sign in to comment.