From c4ff26ab65239a9a4474852b61be758d6d58bfbf Mon Sep 17 00:00:00 2001 From: Leslie Wong <79917148leslie@gmail.com> Date: Wed, 13 Oct 2021 21:07:37 +0800 Subject: [PATCH] :wrench: chore: add husky commit-msg --- commit-msg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 commit-msg diff --git a/commit-msg b/commit-msg new file mode 100644 index 0000000..870c35f --- /dev/null +++ b/commit-msg @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Validate commit log + +commit_regex="^Merge.+|(:tada: feat|:bug: fix|:pencil: docs|:art: style|:hammer: refactor|:racehorse: perf|:cop: test|:construction: build|:rocket: ci|:wrench: chore|:arrow_backward: revert)(\(.+\))?: .{1,50}" + +msg=`cat $HUSKY_GIT_PARAMS` + +if [[ "$msg" =~ $commit_regex ]]; then + exit 0 +else + echo " Please use a valid commit message. " + echo " See commit_regex in commit_msg for more details. " + exit 1 +fi