Automatically assign merge request for review based on eligible approvers
When publishing MRs it's often needed/wanted to have somebody to review it. This however poses a problem: who do you CC/assign the MR to? Assigning it to specific people will result in those being overloaded with work, and it's not always clear who else would be interested in reviewing the MR.
Rust for example deals with this problem by having merge requests randomly assigned to a contributor by a bot (https://github.com/rust-lang/rust/pull/29113#issuecomment-148863046). Once assigned a contributor can either review the merge request or pass it on to somebody else (effectively starting the process over again).
Further details
We have built a version of this in Danger and should try to implement natively in GitLab.
Original request
Having something similar in GitLab (minus abusing bots/comments for this) would make getting started with contributing easier I feel. Instead of having to worry "Who do I assign this to?" the system assigns the merge request to a contributor (= somebody who has push access to the repository). Basically the flow would be as following:
- A developer creates a merge request without explicitly assigning somebody
- The system picks a random contributor who was active in the last 2 weeks and assigns this person to the merge request
- A notification is sent to said contributor about being assigned to this merge request
- Said contributor either reviews the merge request or restarts the process by setting "Assign to" to "Random"
This system could be further extended to automatically CC a list of random people, preventing the development of a "CC bias" (where somebody CCs the same people over and over). This could be something as simple as subscribing 3 random contributors and sending them a notification, allowing them to unsubscribe as usual.
Proposal
Add a button Auto assign that automatically assigns the merge request to eligible approvers, so that if every user assigned to the merge request, also approved the merge request, the merge request would be approved.
The auto-assign button should:
- get the distinct set of eligible approvers for all required approval rules (including require code owners) where an eligible approver is not assigned to the issue
- select an approver at random and assign
- repeat