Repository navigation
fix(review-pr): 移除无效的事件判断 - #294
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
结论
本次变更可安全合并:删除的条件恒为真,行为无变化。
核查要点
- 死代码认定成立:
.github/workflows/review-pr.yml的触发器仅有workflow_dispatch、issue_comment、pull_request_target(第 4、9、11 行),不存在pull_request触发器,故github.event_name != 'pull_request'恒为真;删除后对Mark PR review status pending与Mark PR review status complete两个状态上报步骤无行为影响。 - 改动精确且最小:仅删除恒真合取项;
.github/workflows/review-pr.yml:103与.github/workflows/review-pr.yml:256保留的head_sha != '' && head_repo == github.repository守卫仍承担“不向 fork 仓库 SHA 写入状态”的原意。 - 测试同步加强:
.github/aicodingflow-tests/test_review_workflow_dispatch.py:93与.github/aicodingflow-tests/test_review_workflow_dispatch.py:179由分散的assertIn改为对完整if表达式做assertEqual,与工作流实际字符串逐字一致,后续再引入冗余条件会被直接捕获。 - 无遗漏引用:在
.github/、docs/、README.md、AGENTS.md中检索event_name != 'pull_request'已无剩余引用,不存在因删除条件而失效的文档或其他测试断言。 - 未发现安全相关风险,不涉及权限、密钥、输入校验或数据流变更。
Contributor
There was a problem hiding this comment.
改动移除 review-pr.yml 两个状态上报步骤中恒为真的 github.event_name != 'pull_request' 条件,并同步收紧 workflow 测试断言,行为保持不变。
核对依据:
- 该 workflow 的触发器只有
pull_request_target、issue_comment、workflow_dispatch,github.event_name不可能等于'pull_request',且现有测试已断言on中不存在pull_requesttrigger,docs/product/wiki/summaries/pr-review-verdict.md也记录了「review-pr.yml不监听 GitHubpull_request事件」,因此被删条件确为死代码。 - 全仓库仅
review-pr.yml写入AI PR Reviewcommit status,删除该条件不会引入重复状态上报。 - 同仓库 head 限制仍由保留的
steps.pr.outputs.head_repo == github.repository与steps.pr.outputs.head_sha != ''保证,fork PR 状态上报语义未改变。 - 测试由
assertIn改为对完整if字符串的assertEqual,断言与 workflow 实际值一致,属于增强而非削弱。
未发现正确性、安全、错误处理、性能或文档一致性问题;无阻塞项。
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.
变更
github.event_name != 'pull_request'条件。验证
PYTHONPATH=/tmp/aicodingflow-test-deps PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s .github/aicodingflow-tests -p 'test_review_workflow_dispatch.py'(9 项通过)actionlint .github/workflows/review-pr.ymlgit diff --check