1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-08 02:42:44 +00:00

chore(git): enabled pre-commit git hook

This commit is contained in:
Yury Shkoda
2021-06-09 09:13:40 +03:00
parent 7a738a8904
commit 6b8ef6c55a
2 changed files with 19 additions and 0 deletions

18
.git-hooks/commit-msg Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
RED="\033[1;31m"
GREEN="\033[1;32m"
# Get the commit message (the parameter we're given is just the path to the
# temporary file which holds the message).
commit_message=$(cat "$1")
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z \-]+\))?!?: .+$") then
echo "${GREEN} ✔ Commit message meets Conventional Commit standards"
exit 0
fi
echo "${RED}❌ Commit message does not meet the Conventional Commit standard!"
echo "An example of a valid message is:"
echo " feat(login): add the 'remember me' button"
echo " More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
exit 1

View File

@@ -7,6 +7,7 @@
"start": "nodemon ./src/index.ts",
"build": "tsc --project ./",
"semantic-release": "semantic-release -d",
"postinstall": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true"
},
"author": "Analytium",
"dependencies": {