Skip to content

[CICD] add PR checker workflow - #451

Merged
Libotry merged 2 commits into
AISBench:masterfrom
SJTUyh:ci_check
Aug 11, 2026
Merged

[CICD] add PR checker workflow#451
Libotry merged 2 commits into
AISBench:masterfrom
SJTUyh:ci_check

Conversation

@SJTUyh

@SJTUyh SJTUyh commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks for your contribution; we appreciate it a lot. The following instructions will make your pull request healthier and help you get feedback more easily. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
感谢您的贡献,我们非常重视。以下说明将使您的拉取请求更健康,更易于获得反馈。如果您不理解某些项目,请不要担心,只需提交拉取请求并从维护人员那里寻求帮助即可。

PR Type / PR类型

  • Feature(功能新增)
  • Bugfix(Bug 修复)
  • Docs(文档更新)
  • CI/CD(持续集成/持续部署)
  • Refactor(代码重构)
  • Perf(性能优化)
  • Dependency(依赖项更新)
  • Test-Cases(测试用例更新)
  • Other(其他)

Related Issue | 关联 Issue
Relates to #无(仓库治理类变更)
Fixes #452

🔍 Motivation / 变更动机

随着仓库 PR 数量与外部 fork 贡献增加,亟需一个统一的"PR 合入前质量门禁",杜绝以下情况流入主干:

  • 单 PR 改动过大(新增 >1000 行),难以检视;
  • PR 未关联 Issue,成为孤儿 PR;
  • PR 没有任何检视意见即合入;
  • 检视意见未闭环(行内 review thread 未 Resolve);
  • feature / 较大 bugfix 类型 PR 缺少 tests/UT/ 下的单元测试覆盖。

本次新增 PR Quality Check GitHub Actions 工作流,对所有 PR(含 fork PR)统一执行五项检查;任一项不通过即调用 core.setFailed() 让 status check 红叉,配合仓库 Settings → Branches 中的 Required status check 即可真正阻止合入。

📝 Modification / 修改内容

  1. 新增 benchmark/.github/workflows/pr_quality_check.yml

    • 触发时机pull_request_targetopened / synchronize、PR 评论 issue_comment.created/pr_check 命令、workflow_dispatch
    • 五项检查(不通过即加对应红色 d73a4a 标签并 core.setFailed,通过则移除标签):
      检查 失败标签 判定
      超大 PR large_pr pullRequest.additions > 1000
      关联 Issue no_issue closingIssuesReferences 或 PR body 含 #123 / issues/123
      含检视意见 no_review 至少一条 APPROVED / CHANGES_REQUESTED / COMMENTED 的 review
      检视意见闭环 review_opened 所有 reviewThreads.isResolved = true
      必备 UT no_UT feature 标签必带 tests/UT/ 变更;bugfix 标签且 additions > 50 必带 tests/UT/ 变更
    • fork PR 兼容:移除此前会过滤 fork PR 的 if: 条件;token 只读时写标签 API 报 403 已被静默 catch,不影响 status check 判定,拦截能力不受影响。
    • 失败可视化:PR 下自动评论失败原因;标签缺失时自动创建红色标签。
  2. 修改 benchmark/.github/pull_request_template.md

    • 在 "Useful CI Command" 表格中追加 /pr_check 命令说明。

📐 Associated Test Results / 关联测试结果

可在测试分支分别构造以下场景验证(建议首次启用前先在旁支验证,再合入 main 并启用分支保护规则):

场景 预期
新 PR,additions > 1000 失败 + large_pr 标签
新 PR,body 无 #N 且无 closingIssuesReferences 失败 + no_issue 标签
新 PR,无任何 review 失败 + no_review 标签
PR 有 review thread 未 Resolve 失败 + review_opened 标签
feature 标签但 tests/UT/ 无变更 失败 + no_UT 标签
全部条件满足 通过
PR 评论区单独一行 /pr_check 再次触发检查

测试仓库验证:
文档PR: AISBench/ci_test#37
正常PR带UT: AISBench/ci_test#36
小PR:AISBench/ci_test#35
超大PR: AISBench/ci_test#34

⚠️ BC-breaking (Optional) / 向后不兼容变更(可选)

无。本次仅新增 workflow 与 PR 模板微调,不涉及运行时逻辑变更。

⚠️ Performance degradation (Optional) / 性能下降(可选)

每个 PR 多一次 GraphQL + 一次 PR files 分页查询的耗时,单次 < 5s,对 CI 总时长影响可忽略。

🌟 Use cases (Optional) / 使用案例(可选)

  • 贡献者提 PR 后自动收到红色失败标签 + 评论,提示缺失项,整改后再 push 或评论 /pr_check 即可重新评估,无需 push 空 commit。
  • 管理员在主仓启用 PR Quality Gate 为 Required status check 后,fork PR 同样受门禁约束——通过 status check 失败阻断合入,标签写权限缺失时仅在日志 warning,不影响拦截判定。
  • review 闭环、Issue 关联、UT 覆盖等质量指标由 CI 统一看护,不再依赖人工 review 时挨个核对。

✅ Checklist / 检查列表

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues. / 使用预提交或其他 linting 工具来修复潜在的 lint 问题。
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests. / 修复的 Bug 已完全由单元测试覆盖,导致 Bug 的情况应在单元测试中添加。
  • The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness. / 此拉取请求中的修改已完全由单元测试覆盖。如果不是,请添加更多单元测试以确保正确性。
  • All relevant documentation (API docs, docstrings, example tutorials) has been updated to reflect these changes. / 所有相关文档(API 文档、文档字符串、示例教程)已更新以反映这些更改。

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects. / 如果此拉取请求对下游或其他相关项目有潜在影响,应在那些项目中测试此 PR。
  • CLA has been signed and all committers have signed the CLA in this PR. / CLA 已签署,且本 PR 中的所有提交者均已签署 CLA。

👥 Collaboration Info / 协作信息

  • Suggested Reviewers / 建议审核人: @SJTUyh
  • Relevant Module Owners / 相关模块负责人: @SJTUyh
  • Other Collaboration Notes / 其他协作说明:
    • 本 PR 合入后,管理员需在仓库 Settings → Branches → 分支保护规则中把 PR Quality Gate 勾为 Required status check,否则仅加标签而不会真正阻断合入。

🌟 Useful CI Command / 实用的CI命令

Command / 命令 Introduction / 介绍
/gemini review Performs a code review for the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 执行代码审核。
/gemini summary Provides a summary of the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 提供摘要。
/gemini help Displays a list of available commands of Gemini. / 显示 Gemini 可用命令的列表。
/readthedocs build Triggers a build of the documentation for the current pull request in its current state by Read the Docs. / 触发当前拉取请求在当前状态下由 Read the Docs 构建文档。
/pr_check 手动重新触发 PR 合入质量检查工作流(PR Quality Check),并在 PR 上评论即可生效。 / Manually re-runs the PR Quality Check workflow by commenting on the pull request.

@github-actions github-actions Bot added the other label Aug 11, 2026
@SJTUyh SJTUyh self-assigned this Aug 11, 2026
@SJTUyh
SJTUyh requested review from Libotry and ivanbao9783 August 11, 2026 09:25
@Libotry
Libotry merged commit 4af85cc into AISBench:master Aug 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[需求] PR合入前需要添加基本检查

2 participants