Skip to content

Commit

Permalink
build(husky): ensure hooks do not run on rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Jan 10, 2024
1 parent d72ae87 commit 913cbd0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

beginswith() { case $2 in "$1"*) true;; *) false;; esac; }

if beginswith 'rebase' "$GIT_REFLOG_ACTION"; then
echo 'husky-hook::commit-msg: skipped commit-msg hook due to rebase'
exit 0
fi

npx commitlint -e
if [ -z $GAC_VERIFY_SIMPLE ]; then npm run test; fi
echo
Expand Down
7 changes: 7 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

beginswith() { case $2 in "$1"*) true;; *) false;; esac; }

if beginswith 'rebase' "$GIT_REFLOG_ACTION"; then
echo 'husky-hook::commit-msg: skipped pre-commit hook due to rebase'
exit 0
fi

if [ -z $GAC_VERIFY_SIMPLE ]; then npm run lint:all; fi
NODE_ENV=format npx lint-staged --concurrent false

0 comments on commit 913cbd0

Please sign in to comment.