Skip to content

Commit 46ec114

Browse files
committed
chore: update commit hook to only skip on amend and rebase; update url for github preview workflow
1 parent efe0c4f commit 46ec114

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

.github/workflows/preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ jobs:
2929
source-dir: ./packages/__docs__/__build__
3030
preview-branch: gh-pages
3131
umbrella-dir: pr-preview
32+
pages-base-url: instructure.design
3233
action: auto

.husky/prepare-commit-msg

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# Don't run this hook on --amend or rebase
2-
# From https://github.com/commitizen/cz-cli/issues/672#issuecomment-1328123802
3-
#
4-
# Explanation:
5-
# Per the [prepare-commit-msg hook docs](https://git-scm.com/docs/githooks#_prepare_commit_msg),
6-
# the second argument can have these values:
7-
# - Empty: No message supplied
8-
# - "message": Message was supplied via -m or -F
9-
# - "template": Template was supplied via -t or via commit.template git config
10-
# - "merge": Commit is a merge commit or .git/MERGE_MSG file exists
11-
# - "squash": .git/SQUASH_MSG file exists
12-
# - "commit": -c, -C, or --amend was supplied. In this case, the script gets a third argument representing the commit object.
1+
# Skip the hook during --amend or rebase
132

14-
if [ -z "$2" ]; then
15-
exec < /dev/tty && npx cz --hook
3+
# Check if the commit is an amend (source is "commit" with a third argument)
4+
if [ "$2" = "commit" ] && [ -n "$3" ]; then
5+
exit 0
166
fi
7+
8+
# Check if a rebase is in progress
9+
if [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
10+
exit 0
11+
fi
12+
13+
# Otherwise, run Commitizen
14+
exec < /dev/tty && npx cz --hook

0 commit comments

Comments
 (0)