-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sarthakjdev <[email protected]>
- Loading branch information
1 parent
0cdfca4
commit 1e8f98b
Showing
3 changed files
with
46 additions
and
0 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,26 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
|
||
# check for conventional commit format | ||
commit_msg=$(cat "$1") | ||
# Regex to match Conventional Commit format | ||
conventional_commit_regex='^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+?\))?: .{1,}$' | ||
|
||
if ! [[ "$commit_msg" =~ $conventional_commit_regex ]]; then | ||
echo "ERROR: Commit message does not adhere to Conventional Commits format:" | ||
echo "$commit_msg" | ||
exit 1 | ||
fi | ||
|
||
|
||
# If not a merge commit, require commit to be signed off | ||
if [ ! -e .git/MERGE_MSG ] && ! grep -q "^Signed-off-by: " "$1"; then | ||
echo >&2 "Commit message must be signed off with your user name and email." | ||
echo >&2 "To sign off your commit, add the -s flag to the git commit command." | ||
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,11 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
branch=`git symbolic-ref HEAD` | ||
|
||
if [ "$branch" = "refs/heads/master" ]; then | ||
echo "\\033[31mDirect commit to master is not allowed.\\033[0m" | ||
exit 1 | ||
fi | ||
|
||
go fmt ./... |
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,9 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
branch=`git symbolic-ref HEAD` | ||
|
||
if [ "$branch" = "refs/heads/master" ]; then | ||
echo "\\033[31mDirect push to master is not allowed.\\033[0m" | ||
exit 1 | ||
fi |