Skip to content

[Execute Infrastructure] Add bot approval required check gated on risemeup1111 approval#1460

Merged
risemeup1 merged 6 commits into
PaddlePaddle:developfrom
liuhao2638:ci/bot-approval-required-check
Jul 14, 2026
Merged

[Execute Infrastructure] Add bot approval required check gated on risemeup1111 approval#1460
risemeup1 merged 6 commits into
PaddlePaddle:developfrom
liuhao2638:ci/bot-approval-required-check

Conversation

@liuhao2638

@liuhao2638 liuhao2638 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Devs

Description

新增 .github/workflows/bot-approval-required.yml,在 pull_requestpull_request_review 事件上作为合入门禁的 required status check。

门禁通过条件(满足任一即可,且仅统计当前 head commit 上的评审):

  1. AI review 机器人 risemeup1111 对当前 head commit 提交了 APPROVED 评审;
  2. sneaxiyFrom00 任意一个账号对当前 head commit 提交了 APPROVED 评审。

未通过时的中文提醒: 提示 RD 按 AI review 机器人的意见修改代码并提交新 commit,或联系 sneaxiy / From00 approve;并附 P0/P1(必须修复并提交新 commit)、P2/P3(需针对评论回复)处理要求。

可靠性处理:

  • 按 review 的 commit_id 过滤到 github.event.pull_request.head.sha,避免旧 commit 上的审批在 push 新提交后仍放行未复审的新代码。
  • 使用 gh api --paginate ... | jq -s 'add' 分页读取全部 reviews,避免超过 100 条时漏判。
  • 仅需 contents: readpull-requests: read 权限。

PaddlePaddle-bot

This comment was marked as outdated.

@liuhao2638 liuhao2638 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有两处需要先修复的门禁正确性问题,细节已放在行级评论中。

  • P3 优先级:P3 非行级:当前 Check PR Description 检查失败,日志显示 PR 描述没有按仓库模板提供合法的 PR CategoryPR Types。请按模板补充,例如 PR Category: Execute InfrastructurePR Types: Devs(或维护者认可的更合适分类),并同步修正描述里的机器人账号拼写。
    处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.


env:
# GitHub login of the review bot that must approve before merge.
REQUIRED_BOT_LOGIN: raisemeup1111

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 优先级:P0

当前配置的是 raisemeup1111,但本次评审代理实际使用的 GitHub login 是 risemeup1111,仓库现有 .github/workflows/cherry-pick.yml 里也使用的是 risemeup1111。如果把这个检查设为 required,risemeup1111 提交的 approve 不会被识别,门禁会一直失败并阻塞合入。请把环境变量以及 PR 标题/描述中的账号拼写统一修正为真实机器人 login。

处理要求:请针对该评论修复并提交新的 commit。

Suggested change
REQUIRED_BOT_LOGIN: raisemeup1111
REQUIRED_BOT_LOGIN: risemeup1111

Comment on lines +54 to +57
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")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 优先级:P1

这里按机器人账号筛出“最新决定性评审”后直接判定通过,但没有确认该评审对应当前 PR head。这样一来,机器人在 commit A approve 后,作者再 push commit B,synchronize 会重新运行本检查,但旧的 APPROVED 仍会被选中,门禁会在未复审新代码的情况下通过。请同时按 review 的 commit_id 过滤到当前 github.event.pull_request.head.sha,确保只有当前提交上的机器人 approve 能放行。

处理要求:请针对该评论修复并提交新的 commit。

Suggested change
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")

@liuhao2638 liuhao2638 changed the title ci: add bot-approval-required check gated on raisemeup1111 approval ci: 新增机器人审批门禁(risemeup1111 approve,或 jinle+ruibiao 双人 approve 后通过) Jul 14, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@liuhao2638 liuhao2638 changed the title ci: 新增机器人审批门禁(risemeup1111 approve,或 jinle+ruibiao 双人 approve 后通过) ci: 新增机器人审批门禁(risemeup1111 approve,或 jinle/ruibiao 任一人 approve 后通过) Jul 14, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@liuhao2638 liuhao2638 changed the title ci: 新增机器人审批门禁(risemeup1111 approve,或 jinle/ruibiao 任一人 approve 后通过) ci: 新增机器人审批门禁(risemeup1111 approve,或 sneaxiy/From00 任一账号 approve 后通过) Jul 14, 2026
PaddlePaddle-bot

This comment was marked as outdated.

@liuhao2638 liuhao2638 changed the title ci: 新增机器人审批门禁(risemeup1111 approve,或 sneaxiy/From00 任一账号 approve 后通过) [Execute Infrastructure] Add bot approval required check gated on risemeup1111 approval Jul 14, 2026
@liuhao2638

Copy link
Copy Markdown
Contributor Author

已按评审意见修改并提交新 commit(a41dbdd),逐条处理如下:

  • F1 / P1(commit_id 未过滤当前 head):已修复。传入 HEAD_SHA 并在 jq 中 select(.commit_id == $head),仅统计当前 head commit 上的评审,旧 commit 的审批在 push 新提交后自动失效。
  • F2(reviews 仅读第一页):已修复。改用 gh api --paginate ... | jq -s 'add' 分页读取全部 reviews。
  • P0(机器人账号拼写 raisemeup1111 → risemeup1111):workflow env、PR 标题与描述均已统一为 risemeup1111
  • P3(PR 描述缺少模板 PR Category / PR Types):已按仓库模板补充 PR Category: Execute InfrastructurePR Types: Devs,标题已加 [Execute Infrastructure] tag。

PaddlePaddle-bot

This comment was marked as outdated.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查,当前版本已按当前 head commit 过滤评审,并分页读取全部 reviews;PR 标题和描述也已按模板补齐。未发现需要阻塞合入的问题。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@risemeup1
risemeup1 merged commit 02372bc into PaddlePaddle:develop Jul 14, 2026
27 of 34 checks passed
@risemeup1111

Copy link
Copy Markdown
Contributor

✅ Cherry-pick successful! Created PR: #1462

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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
影响面 TagExecute 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 CategoryPR TypesDescription 三段;历史规范建议已修复。

总体评价

当前实现已按 head commit 过滤 review,并通过 gh api --paginate | jq -s 'add' 拉取全部 reviews,修复了上轮指出的两个门禁误判风险。未发现需要阻塞合入的新问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants