[Execute Infrastructure] Add bot approval required check gated on risemeup1111 approval#1460
Conversation
liuhao2638
left a comment
There was a problem hiding this comment.
有两处需要先修复的门禁正确性问题,细节已放在行级评论中。
优先级:P3 非行级:当前
Check PR Description检查失败,日志显示 PR 描述没有按仓库模板提供合法的PR Category和PR Types。请按模板补充,例如PR Category: Execute Infrastructure、PR Types: Devs(或维护者认可的更合适分类),并同步修正描述里的机器人账号拼写。
处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。
|
|
||
| env: | ||
| # GitHub login of the review bot that must approve before merge. | ||
| REQUIRED_BOT_LOGIN: raisemeup1111 |
There was a problem hiding this comment.
当前配置的是 raisemeup1111,但本次评审代理实际使用的 GitHub login 是 risemeup1111,仓库现有 .github/workflows/cherry-pick.yml 里也使用的是 risemeup1111。如果把这个检查设为 required,risemeup1111 提交的 approve 不会被识别,门禁会一直失败并阻塞合入。请把环境变量以及 PR 标题/描述中的账号拼写统一修正为真实机器人 login。
处理要求:请针对该评论修复并提交新的 commit。
| REQUIRED_BOT_LOGIN: raisemeup1111 | |
| REQUIRED_BOT_LOGIN: risemeup1111 |
| latest_state=$(echo "${reviews}" | jq -r --arg bot "${REQUIRED_BOT_LOGIN}" ' | ||
| [ .[] | ||
| | select(.user.login == $bot) | ||
| | select(.state == "APPROVED" or .state == "CHANGES_REQUESTED" or .state == "DISMISSED") |
There was a problem hiding this comment.
这里按机器人账号筛出“最新决定性评审”后直接判定通过,但没有确认该评审对应当前 PR head。这样一来,机器人在 commit A approve 后,作者再 push commit B,synchronize 会重新运行本检查,但旧的 APPROVED 仍会被选中,门禁会在未复审新代码的情况下通过。请同时按 review 的 commit_id 过滤到当前 github.event.pull_request.head.sha,确保只有当前提交上的机器人 approve 能放行。
处理要求:请针对该评论修复并提交新的 commit。
| latest_state=$(echo "${reviews}" | jq -r --arg bot "${REQUIRED_BOT_LOGIN}" ' | |
| [ .[] | |
| | select(.user.login == $bot) | |
| | select(.state == "APPROVED" or .state == "CHANGES_REQUESTED" or .state == "DISMISSED") | |
| latest_state=$(echo "${reviews}" | jq -r \ | |
| --arg bot "${REQUIRED_BOT_LOGIN}" \ | |
| --arg head_sha "${{ github.event.pull_request.head.sha }}" ' | |
| [ .[] | |
| | select(.user.login == $bot) | |
| | select(.commit_id == $head_sha) | |
| | select(.state == "APPROVED" or .state == "CHANGES_REQUESTED" or .state == "DISMISSED") |
…o (either) approves; add P0-P3 requirements
|
已按评审意见修改并提交新 commit(a41dbdd),逐条处理如下:
|
risemeup1111
left a comment
There was a problem hiding this comment.
已复查,当前版本已按当前 head commit 过滤评审,并分页读取全部 reviews;PR 标题和描述也已按模板补齐。未发现需要阻塞合入的问题。
|
✅ Cherry-pick successful! Created PR: #1462 |
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-07-14 17:41:10
📋 Review 摘要
PR 概述:新增 Bot Approval Required workflow,要求当前 head commit 上 risemeup1111 或指定人工账号的 APPROVED review 后才放行。
变更范围:.github/workflows/bot-approval-required.yml
影响面 Tag:Execute Infrastructure CI
问题
未发现阻塞性问题。PR 规范检查见下方。
历史 Findings 修复情况
| Finding | 问题 | 状态 |
|---|---|---|
| F1 | 只按机器人最新 decisive review 的 state 判断,没有确认 review 是否属于当前 PR head commit。 |
✅ 已修复 |
| F2 | 只读取 reviews API 第一页,per_page=100 不会自动包含第 2 页之后的 review。 |
✅ 已修复 |
📝 PR 规范检查
符合规范。标题已使用 [Execute Infrastructure] Tag,PR body 包含 §D2 要求的 PR Category、PR Types、Description 三段;历史规范建议已修复。
总体评价
当前实现已按 head commit 过滤 review,并通过 gh api --paginate | jq -s 'add' 拉取全部 reviews,修复了上轮指出的两个门禁误判风险。未发现需要阻塞合入的新问题。
…emeup1111 approval (PaddlePaddle#1460)
PR Category
Execute Infrastructure
PR Types
Devs
Description
新增
.github/workflows/bot-approval-required.yml,在pull_request与pull_request_review事件上作为合入门禁的 required status check。门禁通过条件(满足任一即可,且仅统计当前 head commit 上的评审):
risemeup1111对当前 head commit 提交了APPROVED评审;或sneaxiy或From00任意一个账号对当前 head commit 提交了APPROVED评审。未通过时的中文提醒: 提示 RD 按 AI review 机器人的意见修改代码并提交新 commit,或联系 sneaxiy / From00 approve;并附 P0/P1(必须修复并提交新 commit)、P2/P3(需针对评论回复)处理要求。
可靠性处理:
commit_id过滤到github.event.pull_request.head.sha,避免旧 commit 上的审批在 push 新提交后仍放行未复审的新代码。gh api --paginate ... | jq -s 'add'分页读取全部 reviews,避免超过 100 条时漏判。contents: read与pull-requests: read权限。