Identify approval review workflows by file path
按文件路径识别审批评审工作流
GitHub can populate a workflow run's `name` with its expanded `run-name`. The approval review workflow includes the pull-request number in that title, so comparing `workflow_run.name` with the static workflow name rejects valid review events before refreshing the approval status.
English
Problem
GitHub can populate a workflow run's name with its expanded run-name. The approval review workflow includes the pull-request number in that title, so comparing workflow_run.name with the static workflow name rejects valid review events before refreshing the approval status.
Decision
The approval publisher identifies the review-event workflow by its exact workflow_run.path. It also requires a successful pull_request_review run, parses the pull-request number from display_title, validates any supplied pull-request association, and compares the current pull-request head with the reviewed head before evaluating approvals.
Alternatives considered
Accept a name prefix. A display name does not identify the workflow file; another workflow can use the same title.
Remove the numbered run title. The title supplies the pull-request number when GitHub returns an empty pull_requests array. Removing it requires a different handoff mechanism.
Consequences
Run-title expansion does not prevent approval refreshes, while an unexpected workflow file still fails validation. Moving the review-event workflow requires updating the publisher's expected path.
Approval policy tests cover a numbered run name, invalid source paths and events, unsuccessful runs, invalid titles, and superseded heads. The approval outcome policy continues to own pending and successful status semantics.
中文
问题
GitHub 可能用展开后的 run-name 填充工作流运行的 name。审批评审工作流在该标题中包含拉取请求编号,因此将 workflow_run.name 与静态工作流名称比较,会在刷新审批状态前拒绝有效的评审事件。
决策
审批发布器 按精确的 workflow_run.path 识别评审事件工作流。它还要求该运行由 pull_request_review 触发且成功完成,从 display_title 解析拉取请求编号,验证提供的拉取请求关联,并在计算审批结果前将拉取请求当前的头提交与已评审的头提交进行比较。
考虑过的替代方案
接受名称前缀。 显示名称无法识别工作流文件;另一个工作流可以使用相同的标题。
删除带编号的运行标题。 当 GitHub 返回空的 pull_requests 数组时,标题提供拉取请求编号。删除它需要另一种传递机制。
影响
运行标题的展开不会阻止审批刷新,而非预期的工作流文件仍无法通过验证。移动评审事件工作流时,需要更新发布器预期的路径。
审批策略测试 覆盖带编号的运行名称、无效的来源路径和事件、未成功的运行、无效标题以及已被替代的头提交。审批结果策略 继续负责待定与成功状态的语义。