From 575dc5159087d4ab4e1073098bb0b2b0d60e6fff Mon Sep 17 00:00:00 2001 From: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com> Date: Tue, 5 Jul 2022 18:20:04 +0530 Subject: [PATCH] feat(husky): add DAO settings in hook --- .husky/commit-msg | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.husky/commit-msg b/.husky/commit-msg index b7e7ecc3..ff455dc5 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,21 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" +NAME=$(git config user.name) +EMAIL=$(git config user.email) + +if [ -z "$NAME" ]; then + echo "empty git config user.name" + exit 1 +fi + +if [ -z "$EMAIL" ]; then + echo "empty git config user.email" + exit 1 +fi + +git interpret-trailers --if-exists doNothing --trailer \ + "Signed-off-by: $NAME <$EMAIL>" \ + --in-place "$1" + npm exec --no -- commitlint --edit $1