当创建评审时,我能让Github自动将一组人添加到评审中吗?
理想情况下,我希望创建一组人员,并且只有当该组中至少有一个人接受了更改时才能合并。
这一群体将是该地区的中小企业。其他评审员可以评论和接受,但只有在至少有一家中小企业接受了这一改变后,PR才能被合并。
不使用钩子就能在Github中完成吗?
发布于 2017-08-22 03:05:39
是的,没有钩子你就能做到这一切!
批准小组
对于设置“审批组”的问题,可以使用CODEOWNERS文件来设置。
来自吉顿博士 (重点雷):
使用CODEOWNERS文件定义负责存储库中代码的个人或团队。 当某个人打开修改他们拥有的代码的拉请求时,自动请求代码所有者检查。当具有管理权限的人启用了所需的评审时,他们可以选择要求代码所有者批准。
CODEOWNERS文件的格式与.gitignore类似,但在每个作用域旁边都有Github用户名。作用域使用与.gitignore文件相同的规则定义。
(有关示例CODEOWNERS文件,请参阅此答案的结尾。)
所需审查
如果是在Github存储库中设置受保护的分支,也可以启用所需审查。
来自吉顿博士 (同样强调我):
存储库管理员可以要求所有拉请求在被合并到受保护的分支之前至少从具有写或管理权限的人或指定的代码所有者处接收至少一个已批准的审核。 当启用了所需的评审时,任何访问存储库的人都可以批准对拉请求中的更改。但是,要合并您的拉请求,您需要一个在存储库中具有写权限或管理权限的人在他们的评审中批准您的拉请求的更改。如果需要来自指定代码所有者的检查,并且拉请求影响到具有指定所有者的代码,则需要得到该所有者的批准。
CODEOWNERS文件示例(来自吉顿博士):
# 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发布于 2022-01-10 05:26:16
上个星期,当我在一个新的团队中上船时,遇到了这个问题,我偶然发现了这个问题。
创建了一个简单的chrome扩展来创建/保存用户名列表,并将这些列表作为查看器添加到我当前打开的PR上。
它也是开源的,所以可以尝试改进它。
https://stackoverflow.com/questions/45806336
复制相似问题