Files

13 lines
435 B
Bash

#!/usr/bin/env bash
# 防两类事故:改动没进版本库(pathspec 漏提交)+ 红了还推
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
if [ -n "$(git status --porcelain)" ]; then
echo "✗ 工作区有未提交变更,push 已阻止(改动必须先进版本库):" >&2
git status --porcelain >&2
exit 1
fi
node scripts/check.mjs
node scripts/test-integration.mjs
echo "✓ pre-push 检查全部通过"