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.
Extending the first iteration #6961 (closed), when creating or editing a merge request, it should:
- Check the target branch (frequently
master) the presence of a
CODEOWNERSfile in the root directory
- Evaluate the list of changed files against the
CODEOWNERSfile 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
CODEOWNERSrules match, either because there is no
CODEOWNERSfile or no rules that match the changed files, fallback to the existing
- If a
CODEOWNERis 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