Files
yml2213 efde8897c8
代码质量 / backend (push) Waiting to run
代码质量 / frontend (push) Waiting to run
添加提交前检查钩子
2026-08-31 12:31:01 +08:00

26 lines
637 B
Bash
Executable File

#!/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] 本地检查通过"