Require code owner approval
Problem to solve
Both GitLab and GitHub allow to set "require review from Code Owners" in branch protection rules:
-
GitHub documentation: "Optionally, you can choose to require reviews from code owners. If you do, any pull request that affects code with a code owner must be approved by that code owner before the pull request can be merged into the protected branch."
-
GitLab documentation
however "Require Code Owner approval on a protected branch" on GitLab is available on Premium and Ultimate only.
Proposed solution
When possible (on Premium and Ultimate GL) "Require review from Code Owners" rule should be set to the value it has on GitHub when imported to GitLab.
As "Require Code Owner approval on a protected branch" is not available on GL Free, this should be documented.
Technical details
Get default branch protection rule from Github API. Look at required_pull_request_reviews -> require_code_owner_reviews
value and put it into protected branch code_owner_approval_required
attribute.
Note: previously we decided to use the strictest set of branch protection rules (in this issue). So, if the imported protected branch is also protected in GitLab, we will apply the strictest rule for the code_owner_approval_required
attribute.