This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/v0.2.1' into main
- Loading branch information
Showing
16 changed files
with
165 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
COMMIT_MESSAGE="$(head -n1 "$1")" | ||
COMMIT_MESSAGE_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z ]+\))?: .+$" | ||
AUTO_COMMIT_MESSAGE_REGEX="^Merge (pull request|branch) [a-zA-Z0-9#'_/-]+ (of [a-zA-Z0-9#':_. /-]+ )?(from|into) [a-zA-Z0-9#':_. /-]+$" | ||
|
||
|
||
if [[ $COMMIT_MESSAGE =~ $COMMIT_MESSAGE_REGEX || $COMMIT_MESSAGE =~ $AUTO_COMMIT_MESSAGE_REGEX ]]; then | ||
exit 0 | ||
else | ||
echo "Invalid commit message format:" | ||
echo "Your message: '${COMMIT_MESSAGE}'" | ||
echo "" | ||
echo "Please use the following format:" | ||
echo "<type>(<scope>): <subject>" | ||
echo "" | ||
echo " the (<scope>) part is optional" | ||
echo "" | ||
echo "Examples:" | ||
echo "feat(login): add support for email login" | ||
echo "fix: fix issue with user profile image upload" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
# Gitflow branching and naming strategy enforcement for Windows and Mac | ||
|
||
protected_branches="^(main|develop|hotfix/|release/|feature/)" | ||
current_branch=$(git symbolic-ref HEAD | sed 's!refs/heads/!!') | ||
|
||
# Ensure the branch name adheres to the Gitflow naming strategy | ||
if ! [[ ${current_branch} =~ ${protected_branches} ]]; then | ||
echo "Error: The current branch '${current_branch}' does not adhere to the Gitflow naming strategy." | ||
echo "Branch names must match the following patterns: main, develop, hotfix/*, release/*, feature/*." | ||
exit 1 | ||
fi | ||
|
||
# Check if pushing to the correct remote branch | ||
remote_branch=$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)) | ||
if [[ -z "${remote_branch}" ]]; then | ||
echo "Error: The current branch '${current_branch}' has no tracking remote branch." | ||
exit 1 | ||
fi | ||
|
||
remote_name=$(echo ${remote_branch} | cut -d/ -f1) | ||
remote_branch_name=$(echo ${remote_branch} | cut -d/ -f2-) | ||
|
||
if [[ "${current_branch}" != "${remote_branch_name}" ]]; then | ||
echo "Error: The current branch '${current_branch}' must be pushed to a remote branch with the same name: '${remote_name}/${current_branch}'." | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.