From c7510e0f1abc4e029c70afbb19808e8d02e79aae Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Wed, 1 Apr 2026 20:02:15 +0900 Subject: [PATCH] fix(hooks): skip full gate for docs-only commits --- git-hooks/pre-commit | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index fcbe9b663c3..42e6c415193 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -38,6 +38,18 @@ while IFS= read -r -d '' file; do format_files+=("$file") done < <(node "$FILTER_FILES" format -- "${files[@]}") +docs_only=true +for file in "${files[@]}"; do + case "$file" in + docs/*|*.md|*.mdx) + ;; + *) + docs_only=false + break + ;; + esac +done + if [ "${#lint_files[@]}" -gt 0 ]; then "$RUN_NODE_TOOL" oxlint --type-aware --fix -- "${lint_files[@]}" fi @@ -58,7 +70,11 @@ if [[ -f "$ROOT_DIR/package.json" ]] && [[ -f "$ROOT_DIR/pnpm-lock.yaml" ]]; the echo "FAST_COMMIT enabled: skipping pnpm check in pre-commit hook." ;; *) - pnpm check + if [[ "$docs_only" == true ]]; then + echo "Docs-only staged changes detected: skipping pnpm check in pre-commit hook." + else + pnpm check + fi ;; esac fi