From efde8897c8ca24e3c2c226934eecd58e8b1649ba Mon Sep 17 00:00:00 2001 From: yml2213 Date: Mon, 31 Aug 2026 12:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=90=E4=BA=A4=E5=89=8D?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .githooks/pre-push | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 00000000..a02ba3e1 --- /dev/null +++ b/.githooks/pre-push @@ -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] 本地检查通过"