Suggest approvers based on code owners
A code owners file provides a version controlled way of documenting which groups or individuals are key stakeholders in specific areas of the codebase. These people are likely to be the best people to request a code review from and would likely make the best approvers.
Suggesting approvers when opening or editing a merge request is useful to open and flexible teams that do not want to impose rigid workflows, but want to document whom are the best people to request code reviews from.
We should build a simple suggestion based code owners feature, and then incrementally add levels of enforcement for stricter teams.
Proposal
Extending the first iteration https://gitlab.com/gitlab-org/gitlab-ee/issues/6961, when creating or editing a merge request, it should:
- Check the target branch (frequently
master
) the presence of aCODEOWNERS
file in the root directory - Evaluate the list of changed files against the
CODEOWNERS
file to generate the list of users to be notified - The Suggested approvers list in the Edit merge request interface should show the list of users generated above
- If no
CODEOWNERS
rules match, either because there is noCODEOWNERS
file or no rules that match the changed files, fallback to the existinggit log
approach. - If a
CODEOWNER
is not an eligible approver still show them in the list but disabled and with a tooltip explaining they are not an eligible approver.
- If no
Links
https://help.github.com/articles/about-codeowners/