From 7cb1d0c4e07cc0b9b40f55af3cc97a4e0951ca56 Mon Sep 17 00:00:00 2001 From: "I am a robot (AI & Auto)" <124379614+kubbot@users.noreply.github.com> Date: Thu, 13 Jul 2023 11:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20file(s)=20with=20OpenIM?= =?UTF-8?q?SDK/Open-IM-Server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 kubbot to synchronize the warehouse --- scripts/githooks/pre-commit | 2 +- scripts/githooks/pre-push | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit index c14d1a9..cad60e1 100644 --- a/scripts/githooks/pre-commit +++ b/scripts/githooks/pre-commit @@ -26,7 +26,7 @@ LC_ALL=C local_branch="$(git rev-parse --abbrev-ref HEAD)" -valid_branch_regex="^(main|master|develop|release)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" +valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" YELLOW="\e[93m" GREEN="\e[32m" diff --git a/scripts/githooks/pre-push b/scripts/githooks/pre-push index 2ed9736..2985313 100644 --- a/scripts/githooks/pre-push +++ b/scripts/githooks/pre-push @@ -21,6 +21,9 @@ GREEN="\e[32m" RED="\e[31m" ENDCOLOR="\e[0m" +local_branch="$(git rev-parse --abbrev-ref HEAD)" +valid_branch_regex="^(main|master|develop|release(-[a-zA-Z0-9._-]+)?)$|(feature|feat|openim|hotfix|test|bug|ci|cicd|style|)\/[a-z0-9._-]+$|^HEAD$" + printMessage() { printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n" } @@ -96,6 +99,14 @@ print_color "Added Files: ${added_files}" "${BACKGROUND_GREEN}" print_color "Modified Files: ${modified_files}" "${BACKGROUND_GREEN}" print_color "Deleted Files: ${deleted_files}" "${BACKGROUND_GREEN}" +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 + # #printMessage "Running the Flutter analyzer" #flutter analyze