Gitlab CODEWONERS:某些文件不需要批准 (package.json)

Gitlab CODEWONERS: do not require approval for certain files (package.json)

我们正在切换到 gitlab,但无法从 CODEOWENERS 文件中排除 package.json(和锁定)。

我们之前的配置是这样的:

* @team-1

# Since the package.json and the package-lock.json are regularly changed by every team (f.e. when upgrading a specific),
# changing these files is allowed to be changed by anyone (including RenovateBot)
^[PACKAGE]
package.json
package-lock.json

# Explicitly protect CODEOWNERS
CODEOWNERS * @team-1

这以前在 bitbucket 中有效,但现在 * 规则也适用于 package.json。因此 renovate bot 不能再自动合并对 package.json 的更改,因为它们需要 team-1

的批准

我们试图将它们从 * 规则中排除,but negations are not supported by gitlab。在所有 gitlab 示例中,代码结构在不同的文件夹中,适用于不同的团队,但这在这里不适用,因为我们不能像这样重构我们的代码。

package.jsonpackage-lock.json 不需要 team-1 的批准可以实现吗?

您的问题是您正在使用可选部分来排除包文件。

您应该考虑完全不使用可选部分 ^[PACKAGE],而是让每个人都成为包文件的所有者。您已经做过,但仅限于该部分。

例如:

* @team-1

# Since the package.json and the package-lock.json are regularly changed by every team (f.e. when upgrading a specific),
# changing these files is allowed to be changed by anyone (including RenovateBot)
package.json
package-lock.json

# Explicitly protect CODEOWNERS
CODEOWNERS * @team-1

正如此处所述 https://github.com/renovatebot/renovate/issues/6473#issuecomment-855543240