fix(hooks): skip full gate for docs-only commits

This commit is contained in:
Vincent Koc 2026-04-01 20:02:15 +09:00
parent c65e152b39
commit c7510e0f1a
1 changed files with 17 additions and 1 deletions

View File

@ -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