Skip to content

巡检守卫失败时给出明确原因 - #9

Merged
laincat merged 1 commit into
mainfrom
fix/guard-message
Nov 5, 2026
Merged

laincat merged 1 commit into
mainfrom
fix/guard-message

Conversation

@laincat

@laincat laincat commented Nov 5, 2026

Copy link
Copy Markdown
Owner

巡检发布前的守卫是裸命令:

git diff --quiet HEAD origin/main -- monitor/ scripts/ sources/ .github/workflows/patrol.yml .github/scripts/

它退出码非 0 时整步直接 exit 1,日志里只有一个 ##[error]Process completed with exit code 1。2026-11-05 00:26 的巡检就是这么红的,真实原因是合并 #8 在巡检跑完后改了 monitor/catalog.json——守卫按设计拒绝了用旧证据发布,但看起来像"莫名其妙的失败"。

改成显式判断并打印原因,同时提示重跑即可:

if ! git diff --quiet HEAD origin/main -- monitor/ scripts/ sources/ .github/workflows/patrol.yml .github/scripts/; then
  echo "main 上的受信任清单或脚本在本轮巡检之后有更新,放弃本次发布;重跑巡检即可。" >&2
  exit 1
fi

验证:actionlint 通过。行为不变(仍然拒绝发布),只是把原因说出来。

发布前的「受信任清单或脚本在本轮之后被改过」守卫原来是裸的
`git diff --quiet ...`,触发时只有一个 exit 1(2026-11-05 00:26 的巡检就
是这样红的,实际原因是合并 #8 改了 catalog)。改成显式判断并打印原因,
提醒重跑即可,不让人再去猜是哪一步。
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T00:28:40.008714Z 9be9f18 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@laincat
laincat merged commit 51a6ef5 into main Nov 5, 2026
1 check passed
@laincat
laincat deleted the fix/guard-message branch November 5, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant