PR readiness: base ref and labels come from the bind snapshot instead of the live PR

未关闭 适合新手
#2,424 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github-actions, typescript

调研方向

从 scripts/pr-readiness.mjs 开始,阅读加载 PR 并选择基准引用和标签的 run()。然后找到现有的 run() 测试,并添加一个模拟 fetchFn 的用例,覆盖快照基准 dev 与实时基准 main 的对比,以及实时的 skip-changelog 标签。完成标准是比较使用 main,且该标签会影响 changeset 检查;运行相关测试。

由索引模型根据 Issue 内容生成。

描述

Found by: github-integration-dev while fixing a Copilot review finding on #2423 (the #2420 fix). This is outside that PR's scope, so it's tracked here.

Problem

scripts/pr-readiness.mjs run() takes the PR's base ref and labels from environment variables. The bind job sets them from the event snapshot:

  • PR_BASE_REF (line ~471) is used for the "Branch up to date" comparison (compare/<base>...<head>), the checklist text and the links in the comment footer.
  • PR_LABELS (line ~476) feeds "Changeset present", which honours the skip-changelog label.

run() already reads the live PR (GET /pulls/{n}), and that response contains base.ref and labels. Neither is used.

Once #2423 lands, runs for the same PR head share one concurrency group with cancel-in-progress: true. A late delivery from before a base change (an edited event) can therefore cancel the newer run for that head and post a checklist against the old base. A label change has the same effect when it is followed by a refresh for the same head. Stale-head deliveries are not affected: #2423 makes them write nothing.

Suggested fix

In run():

  1. Prefer prData.base.ref and prData.labels[].name from the live PR read. Fall back to the environment values only when that read fails, the same way draft status already prefers API truth (prData?.draft ?? prDraft).
  2. Add a regression test with a mocked fetchFn: a snapshot base of dev and a live base of main must compare against main, and a live skip-changelog label must count when the snapshot lacks it.
Notes
  • The request workflow does not trigger on labeled/unlabeled, so a label change alone doesn't refresh the checklist. This issue is only about using live values when a refresh does run.
  • Low impact: the checklist is advisory, and the next PR event corrects it.
主要语言
TypeScript
星标
3.4k
派生
516
平均合并
1 天 15 小时
30 天内合并 PR
116

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/squad 的其他 Issue

查看 github/squad 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。