- guide §2.1: 接口类条目推送前必须走完 PR 合并→部署测试服→测试服真实 API 验证,backend_status=deployed 才许 push;预告式推送一律禁止(2026-08-10 wx 定,前端投诉实证 #5599/#5567/#5633) - .githooks/pre-push: push 前自动跑文件名+frontmatter 校验,违规拦截;启用 git config core.hooksPath .githooks - 文件名类型枚举文档同步(7 类+frontend 字面量) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
26 行
1.2 KiB
Bash
26 行
1.2 KiB
Bash
#!/bin/sh
|
|
# changelog 发布门禁(推送前强制校验)
|
|
# 启用(每台机一次): git config core.hooksPath .githooks
|
|
# 拦截目标: 接口类 changelog 未部署测试服(backend_status != deployed)就推送给前端,
|
|
# 以及文件名/frontmatter 结构违规。规则实现见 scripts/validate-changelog-*.mjs。
|
|
zero=0000000000000000000000000000000000000000
|
|
status=0
|
|
while read local_ref local_sha remote_ref remote_sha; do
|
|
# 删除远端分支的推送没有本地内容可校验
|
|
[ "$local_sha" = "$zero" ] && continue
|
|
if [ "$remote_sha" = "$zero" ]; then
|
|
base=$(git rev-parse --verify origin/main 2>/dev/null) || continue
|
|
else
|
|
base=$remote_sha
|
|
fi
|
|
[ "$base" = "$local_sha" ] && continue
|
|
node scripts/validate-changelog-filenames.mjs --base "$base" --head "$local_sha" || status=1
|
|
node scripts/validate-changelog-frontmatter.mjs --base "$base" --head "$local_sha" || status=1
|
|
done
|
|
if [ "$status" -ne 0 ]; then
|
|
echo "" >&2
|
|
echo "推送被 changelog 发布门禁拦截:接口类条目必须测试服已部署+实测(backend_status=deployed)后才能推送给前端。" >&2
|
|
echo "修正文件后重试;规则详见 BACKEND_CHANGELOG_DELIVERY_GUIDE.md §2.1。" >&2
|
|
fi
|
|
exit $status
|