ci(shadcn): 按失败类别把 shadcn:check 的退出码路由进 issue 通道 - #3497
Merged
Conversation
`continue-on-error: true` 把 `pnpm shadcn:check` 的退出码整个丢掉;下游 "发现更新就开 issue" 的步骤又以 `if: failure()` 为条件,而被容错的步骤 永远不会让 job 变红——两者叠加使该通道从未执行过一次。 #3455 之后退出码只有一个含义:声明式本地补丁失效(磁盘上标记丢失,或上游 挪走锚点导致下次 --update 无法重施加)。普通漂移与 registry 不可达按设计 仍然退出 0。 现在显式捕获退出码并分三类:patch(告警)、ok(含 registry 不可达,容忍)、 broken(其余非零,也告警——跑不起来的检查不是通过的检查),把告警接进既有的 建/评论 issue 逻辑与标签。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes objectstack-ai/objectstack#5805
前提核验(在 origin/main 上逐条确认)
退出码确实被吞。
.github/workflows/shadcn-check.yml的check步骤带continue-on-error: true,pnpm shadcn:check的退出码原样丢弃。不只是"不标红"——告警通道从未跑过一次。 下游那个"发现更新就开 issue"的步骤条件是
if: failure()。被continue-on-error容错的步骤 conclusion 记为 success,job 状态不变,failure()永远为假。也就是说 workflow 后半段的建 issue 逻辑自写下起就是死代码。旁证:仓库里从来没有过带shadcn-sync标签的 issue(label:shadcn-sync搜索结果 0 条)。退出码的真实语义(fix(components,i18n): Sheet/Dialog 关闭按钮接入 common.close,并让 shadcn 同步机制携带该补丁 (objectstack#5505) #3455 之后)。
scripts/shadcn-sync.js的--check分支只有一个非零来源:patchFailures=missingPatches(磁盘上的文件丢了声明式补丁的 marker)与unappliablePatches(上游挪走锚点,下次--update无法重施加)的去重并集。普通漂移(outdated / modified / UNDOCUMENTED)按设计保持退出 0。registry 不可达本来就不会非零。
checkComponent的两条错误路径都只把组件标成status: 'error',并显式注释"gate 只能指控真实漂移"。所以"容忍 registry 不可达"不需要新写豁免——它本来就已经是退出 0,只要不再吞码即可。前提成立,且比 issue 描述的更糟一档(建 issue 逻辑是死的)。
改了什么
只动
.github/workflows/shadcn-check.yml:check步骤去掉continue-on-error,改为显式捕获退出码(set +e+PIPESTATUS[0]),步骤自身仍恒定退出 0,job 不会因为补丁失效变红——按 PM 裁定:周任务红没人看,进 issue 才进分诊流。三分类,顺序是"先看证据行,再看退出码":
patchcomponent(s) with declared local patch failuresokbroken判据行优先于退出码是刻意的:消息是证据,退出码是脚本可以另行修订的策略。容忍面只覆盖已识别的良性类别,其余一律告警,免得再挖出一个和被吞退出码同形状的缝。
输出去掉 ANSI(脚本无条件上色),artifact 和 issue 正文因此可读;剥离用的是 perl 自己的转义写法,仓库文件里没有任何裸控制字节(objectstack#4890)。
补
permissions: contents: read / issues: write。这条路径从没跑过,谁也没验证过默认 token 建得了 issue;显式声明后,组织级收紧默认权限也不会把唯一的告警通道悄悄变回空操作。建 issue 的步骤故意不加
continue-on-error:它就是告警本身,送不出去必须让 job 红。$GITHUB_STEP_SUMMARY写一段结论,ok且有 registry 错误时另发::warning::——容忍不等于报平安。analyze步骤保持原样:component-analysis.js只有一处非零退出(未捕获崩溃),没有可吞的判决,它的输出是报告的辅助上下文。干跑证据
从 YAML 里解析出真正要发布的
run块,配合桩pnpm跑 5 个真实产出的 fixture(不是手写文本)。方向在运行前先写死:class=ok registry_errors=0 alarm=false,无 annotationRegistry returned no usable file content)class=ok registry_errors=46 alarm=false+::warning::class=patch registry_errors=46 alarm=true+::error::class=patch registry_errors=45 alarm=true+::error::Error loading manifestclass=broken registry_errors=0 alarm=true+::error::5 例全部与预判一致;
check.txt中残留 ESC 字节数 0,临时文件已清理。补丁失效的两类都是在 /tmp 的一次性副本里模拟的,repo 树与scripts/**未被触碰。github-script的 payload 也做了离线渲染(桩github/context):新建分支 title 随类别变化、labels 仍是['maintenance','shadcn-sync','dependencies']、去重查询仍按shadcn-sync标签找已开 issue 并改走createComment—— 与原块行为一致。YAML
yaml.safe_load通过;bash -n通过;node scripts/check-control-bytes.mjs通过,并额外做了越过该 gate 的自查(0x00-0x1f 与 0x7f 全扫)。本机没有 actionlint / shellcheck,这两项没跑。**诚实的边界:**真实的定时运行只能由下周一的 cron 或一次手动
workflow_dispatch证明——建议合并后手动触发一次,顺带验证 token 真的能建 issue。已知限制(有意保留,未在本 PR 处理)
timeout-minutes:--check是 46 次串行请求,挂住会静默烧满默认时限。与退出码无关,未在此改。与 #5803 的关系
不依赖它。分类只读当前脚本已有的输出:
Error fetching from registry:/Registry returned no usable file content/component(s) with declared local patch failures。已核对 #5803 在途分支未改动这三处字符串,它新增的 HTTP 状态码错误仍从fetchUrlreject,落进同一条Error fetching from registry:消息里,分类不受影响。CI-only,无 changeset。
Generated by Claude Code