Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CI script assigns PR reviews based on the list of maintainers #9913

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kurisaW
Copy link
Contributor

@kurisaW kurisaW commented Jan 14, 2025

Fixed #9903

Ps:该CI自动化脚本可自动识别PR修改的文件列表,并根据仓库根目录下的MAINTAINERS文件,映射审核团所维护的path,从而分配审查

下面是该脚本的具体功能说明:

  • 审核方式由github bot自动评论@提及,并且保证仅保留一份最新的机器人评论;
  • 支持动态检测PR内所有被修改、删除、增加的文件;支持被修改文件的递归目录检测;并根据每次最新PR所变更的所有文件内容的追踪,生成实时的审核内容及审查人任命;
  • 支持查看最新PR的审查情况,可根据CI机器人评论的Current Review Status部分查看;
  • 支持自动捕获被任命的评论信息(审核者需要评论 LGTM/lgtm 来告知审查完毕),CI会同步bot机器人的评论:Current Review Status更新审查状况;
  • 支持手动点击🔄 刷新状态来重新运行CI,以此来获取最新的审查情况;
  • 支持一键展开被修改的文件详情,方便定位审查内容。

下面是一个演示效果,也可以通过下方链接查看实际效果:

📌 Code Review Assignment

🏷️ Tag: stm32

Path: bsp/stm32
Reviewers: @kurisaW

Changed Files (Click to expand)
  • bsp/stm32/docs/How to create a RT-Studio project.md

🏷️ Tag: kernel

Path: src
Reviewers: @kurisaW @Nedki-L

Changed Files (Click to expand)
  • src/Kconfig

🏷️ Tag: workflow

Path: .github/workflows
Reviewers: @kurisaW @Nedki-L @KurisaW-Collaborative

Changed Files (Click to expand)
  • .github/workflows/auto-assign-reviewers.yml

📊 Current Review Status (Last Updated: 2025-01-23 06:31 UTC)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@kurisaW kurisaW requested a review from supperthomas as a code owner January 14, 2025 05:48
@github-actions github-actions bot added the action github action yml imporve label Jan 14, 2025
@kurisaW kurisaW marked this pull request as draft January 14, 2025 05:51
@kurisaW kurisaW force-pushed the auto-reviewer branch 3 times, most recently from 3e75f0a to 8d799f2 Compare January 14, 2025 06:09
@kurisaW kurisaW marked this pull request as ready for review January 14, 2025 06:20
@Rbb666 Rbb666 added action github action yml imporve and removed action github action yml imporve labels Jan 14, 2025
@Rbb666 Rbb666 requested a review from mysterywolf January 14, 2025 06:30
@Rbb666 Rbb666 added the BSP: Renesas BSP related with Renesas label Jan 14, 2025
@Rbb666 Rbb666 marked this pull request as draft January 14, 2025 07:05
@supperthomas
Copy link
Member

你这个要加RTTHREAD_GITHUB_TOKEN的吧

@kurisaW
Copy link
Contributor Author

kurisaW commented Jan 14, 2025

你这个要加RTTHREAD_GITHUB_TOKEN的吧

token加了的:

image

但是还不清楚为什么这个仓库解析出了问题:

image

然后在我自己的仓库测试中是可以的,等我找时间再看看:

image

@supperthomas
Copy link
Member

目前这个仓库里面的RTTHREAD_GITHUB_TOKEN 加了吗?还没有加吧?

@kurisaW
Copy link
Contributor Author

kurisaW commented Jan 15, 2025

目前这个仓库里面的RTTHREAD_GITHUB_TOKEN 加了吗?还没有加吧?

应该是有的吧,我是看其他ci文件中有这个token在,然后用的这个,不知道我上面的问题会不会是因为这个token无效导致的

image

@supperthomas
Copy link
Member

目前这个仓库里面的RTTHREAD_GITHUB_TOKEN 加了吗?还没有加吧?

有的,我是看ci文件中有这个token在,然后用的这个,不然没法通过权限的

没有的,那个是我加的。token你找熊大加一下。

@kurisaW
Copy link
Contributor Author

kurisaW commented Jan 15, 2025

目前这个仓库里面的RTTHREAD_GITHUB_TOKEN 加了吗?还没有加吧?

有的,我是看ci文件中有这个token在,然后用的这个,不然没法通过权限的

没有的,那个是我加的。token你找熊大加一下。

噢噢好的,那我另设一个

@supperthomas
Copy link
Member

目前这个仓库里面的RTTHREAD_GITHUB_TOKEN 加了吗?还没有加吧?

有的,我是看ci文件中有这个token在,然后用的这个,不然没法通过权限的

没有的,那个是我加的。token你找熊大加一下。

噢噢好的,那我另设一个

不是我的意思是你还是用RTTHREAD_GITHUB_TOKEN 这个就可以了。这个settings里面的值没有赋值。

@kurisaW
Copy link
Contributor Author

kurisaW commented Jan 15, 2025

@BernardXiong 熊大,麻烦帮忙添加个名为 GITHUB_TOKEN_COMMENT 的token可以嘛,只需要拥有对仓库的评论权限就可以了

@kurisaW kurisaW marked this pull request as ready for review January 16, 2025 01:14
@kurisaW kurisaW closed this Jan 16, 2025
@kurisaW kurisaW reopened this Jan 16, 2025
@unicornx
Copy link
Contributor

unicornx commented Jan 20, 2025

我想了解一下这个工作是否可以和 #9903 结合起来?

具体来说,就是我想问一下,我们是否可以维护一个 MAINTAINER 文件(MAINTAINER 文件中记录了 reviewer 的相关信息),然后利用 MAINTAINER 文件 中的信息来指定 reviewer?

为啥要用 label 信息?感觉 label 信息以后扩展方便吗?

@kurisaW kurisaW marked this pull request as draft January 20, 2025 04:41
@kurisaW kurisaW changed the title ci: appoint PR reviewers via action bot reviews feat: CI script assigns PR reviews based on the list of maintainers Jan 23, 2025
@kurisaW kurisaW force-pushed the auto-reviewer branch 2 times, most recently from a486d22 to 70252d0 Compare January 23, 2025 06:36
@@ -0,0 +1,13 @@
# MAINTAINERS for autoreview assigning in github comment

Copy link
Contributor

Choose a reason for hiding this comment

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

建议在这个文档中开头部分以注释的方式对文档内容的组织方式,以及字段的含义,要求进行自解释。可以学习参考一下 https://github.com/torvalds/linux/blob/master/MAINTAINERS.

解释内容可以参考 #9903 (comment) 中的设计描述。只是需要麻烦翻译为中文。


tag: workflow
path: .github
owners: Li Tao(supperthomas)<[email protected]>
Copy link
Contributor

@unicornx unicornx Jan 23, 2025

Choose a reason for hiding this comment

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

建议即使 owner 字段可以用括号或者尖括号分隔,但是最好也加上空格分开,不加空格给人一种拥挤的感觉。

另外可以支持多个 owner 吗?如果有多个 owner 最好有逗号开。

以上规则我记得上次会议笔记上是有说明的,具体参考 #9903 (comment)

p.s.: 加空格或者逗号后好处理吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action github action yml imporve BSP: Renesas BSP related with Renesas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 为 RTT 建立 maintainer 机制
4 participants