fix(ci): check.sh 的覆盖层路径写错(断言被静默跳过); 并断言首页卡片模板

`ROOT` 是仓库根, 但断言用的是 `${ROOT}/custom/...`, 那个路径根本不存在, 于是
`if [[ -f ... ]]` 永远为假 —— 「生成的 zh-CN 语言文件已无工单」这条从未真正跑过
(在预览/生产上跑都是直接跳过, 看不出来)。改成 `customization/custom/...`。

顺带加上首页(登录后)学期答疑入口卡片的模板层断言: 卡片模板在位 + dashboard.tmpl
里确实 include 了它。渲染结果需要登录才能看, 那部分在 preview.sh check 里
(它用 previewadmin 登录后抓首页)。

实测: customization/check.sh 对预览与生产都跑通(生产多一条 OIDC 入口 307)。
This commit is contained in:
2026-09-22 22:22:56 +08:00
parent 787481c2c8
commit 487c9e8726
+11 -2
View File
@@ -106,10 +106,19 @@ if [[ -d ${ROOT}/issue-templates ]]; then
! grep -rq "example.com" "${ROOT}/issue-templates/" &&
ok "Issue 模板已无 example.com 占位链接" || bad "Issue 模板里仍有 example.com"
fi
if [[ -f ${ROOT}/custom/options/locale/locale_zh-CN.json ]]; then
! grep -q "工单" "${ROOT}/custom/options/locale/locale_zh-CN.json" &&
if [[ -f ${ROOT}/customization/custom/options/locale/locale_zh-CN.json ]]; then
! grep -q "工单" "${ROOT}/customization/custom/options/locale/locale_zh-CN.json" &&
ok "生成的 zh-CN 语言文件已无「工单」" || bad "语言文件里仍有「工单」"
fi
# 首页(登录后)的学期答疑入口卡片: 渲染结果需要登录才能看, 这里只断言模板层
# (运行时的渲染断言在 customization/preview/preview.sh check 里, 要登录)。
if [[ -f ${ROOT}/customization/custom/templates/custom/tjhlp_semester_card.tmpl ]]; then
grep -q "本学期答疑入口" "${ROOT}/customization/custom/templates/custom/tjhlp_semester_card.tmpl" &&
ok "首页答疑入口卡片模板在位" || bad "卡片模板里没有预期的内容"
grep -q 'template "custom/tjhlp_semester_card"' \
"${ROOT}/customization/custom/templates/user/dashboard/dashboard.tmpl" &&
ok "dashboard.tmpl 已 include 学期答疑入口卡片" || bad "dashboard.tmpl 没有 include 卡片"
fi
if [[ ${fail} == 0 ]]; then
echo "全部检查通过"