我的团队<team-1>正在与<team-2>共享一个github。回购程序如下所示(简化示例):
infrastructure/
|
|-- .github/CODEOWNERS
|
|-- directory1/
|
|-- subdirectory1.1/
|
|-- subdirectory1.2/
|
|-- directory2/
|
|-- subdirectory2.1/
|
|-- subdirectory2.2/
|
|-- directory3/
|
|-- subdirectory3.1/
|
|-- subdirectory3.2/<team-2>是回购中每个目录的CODEOWNER,我的团队<team-1>只拥有subdirectory1.1和subdirectory2.1。
换句话说,CODEOWNERS文件如下所示:
github/CODEOWNERS
* @mycompany/team2
/infrastructure/directory1/subdirectory1.1 @mycompany/team1
/infrastructure/directory1/subdirectory1.1 @mycompany/team1鉴于上述情况,我想要做的是将team2从team1拥有的每个文件夹中排除出来,理想情况下不删除代码所有者文件中的通配符。
* @mycompany/team2
/infrastructure/directory1/subdirectory1.1 @mycompany/team1 AND EXCLUDE TEAM2
/infrastructure/directory1/subdirectory1.1 @mycompany/team1 AND EXCLUDE TEAM2在不重写整个代码所有者逻辑的情况下,最好的方法是什么?
发布于 2021-11-01 11:13:37
GitHub本机选项: GitHub操作
您可以尝试配置GitHub Action mszostok/码分多址-验证器,它可以基于指定检查验证GitHub CODEOWNERS文件。
例如:
notowned:如果给定的存储库包含在CODEOWNERS文件中没有指定所有者的文件,则报告。
非GitHUb本机选项
海泡石
如果“代码所有者”是指对文件夹的推/写访问,则Git或GitHub本机不支持这一点:如果您可以推送到存储库的一部分,则可以推送到所有存储库。
您可能考虑的是在您控制的服务器上推送到中间网关存储库,以及您可以在其中设置授权层,如海泡石。
使用Gitolite,您可以使用VREF限制按and和文件更改的名称推入。
就你而言:
repo foo
RW+ = @team2
R = @team1
RW VREF/NAME/infrastructure/directory1/subdirectory1.1 @team1
RW VREF/NAME/infrastructure/directory1/subdirectory2.1 @team1一旦Gitolite验证了push,该服务器就可以依次推送到GitHub。
拆分存储库和git过滤器-repo
但更自然的方法是将存储库分成两部分,将主父team1存储库中的teeam2内容作为子模引用。
不过,考虑到这将涉及历史重写和文件夹重组,这并不容易。
发布于 2022-08-04 21:52:19
从理论上讲,用!作为行的前缀应该有效,因为
! (参见格式化)排除(即重新包含)模式。然而,在实践中,我尝试了这一点,并且从!开始的CODEOWNERS行是无效的,根据mszostok/codeowners-验证器检查,所以没有任何结果。
发布于 2022-10-11 16:52:56
根据文献资料,您的示例应该工作得很好。
引用这个例子:
# 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因此,在这种情况下,似乎有以下情况之一:
https://stackoverflow.com/questions/69750495
复制相似问题