添加提交前检查钩子
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
push_lines="$(cat)"
|
||||||
|
while read -r local_ref local_sha remote_ref remote_sha; do
|
||||||
|
if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
|
||||||
|
echo "[pre-push] 分支删除推送,跳过本地检查"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done <<< "$push_lines"
|
||||||
|
|
||||||
|
if [ "${SKIP_CHECKS:-0}" = "1" ]; then
|
||||||
|
echo "[pre-push] SKIP_CHECKS=1,跳过本地检查"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[pre-push] 运行 backend check..."
|
||||||
|
npm --prefix apps/backend run check
|
||||||
|
|
||||||
|
echo "[pre-push] 运行 frontend check..."
|
||||||
|
npm --prefix apps/frontend run check
|
||||||
|
|
||||||
|
echo "[pre-push] 本地检查通过"
|
||||||
Reference in New Issue
Block a user