创建评论时,我可以让Github自动将一组人添加到评论中吗?
理想情况下,我想创建一组人,只有当该组中至少有一人接受了此更改时才能合并。
该群体将成为该地区的中小企业。其他评论者可以评论和接受,但只有至少有一个中小企业接受了这一变化,才能合并PR。
是否可以在不使用钩子的情况下在Github中进行?
答案 0 :(得分:0)
是的,你可以在没有webhooks的情况下完成所有这些!
有关设置“批准组”的问题,您可以使用CODEOWNERS
文件进行设置。
来自the Github docs(强调我的):
使用CODEOWNERS文件定义负责存储库中代码的个人或团队。
当有人打开修改他们拥有的代码的拉取请求时,会自动请求代码所有者进行审核。当具有管理员权限的用户启用了必需的评论时,他们可以选择要求代码所有者批准。
CODEOWNERS
文件的格式类似于.gitignore
的格式,但每个范围旁边都有Github用户名。范围使用与.gitignore
文件相同的规则定义。
(有关示例CODEOWNERS
文件,请参阅此答案的结尾。)
如果您setup protected branches in your Github repository,您还可以启用required reviews。
从the Github docs(再次强调我的):
存储库管理员可以要求所有拉取请求在合并到受保护分支之前,从具有写入或管理权限的人或指定代码所有者接收至少一个已批准的审核。
如果启用了必需的评论,则有权访问存储库的任何人都可以批准拉取请求中的更改。但是,要合并您的提取请求,您需要在存储库中具有写入或管理权限的人员批准您的提取请求在审核中的更改。如果需要从指定的代码所有者进行审核,并且提取请求会影响具有指定所有者的代码,则需要获得该所有者的批准。
# This is a comment.
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @global-owner1 @global-owner2
# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
# modifies JS files, only @js-owner and not the global
# owner(s) will be requested for a review.
*.js @js-owner
# You can also use email addresses if you prefer. They'll be
# used to look up users just like we do for commit author
# emails.
*.go docs@example.com
# In this example, @doctocat owns any files in the build/logs
# directory at the root of the repository and any of its
# subdirectories.
/build/logs/ @doctocat
# The `docs/*` pattern will match files like
# `docs/getting-started.md` but not further nested files like
# `docs/build-app/troubleshooting.md`.
docs/* docs@example.com
# In this example, @octocat owns any file in an apps directory
# anywhere in your repository.
apps/ @octocat
# In this example, @doctocat owns any file in the `/docs`
# directory in the root of your repository.
/docs/ @doctocat