'Gitlab auto-assign reviewer for merge request
I've been using GitHub for my previous project, and I had what is called auto-assign reviewer for pull requests that automatically assigns a reviewer from my team to do the code review.
now I'm working on a project hosted in Gitlab, I'm asking if gitlab supports this feature for merge requests or is there any alternatives for this feature on gitlab.
I already checked reviewer roulette and danger but it's not clear and I couldn't find any docs on how to implement it.
Thanks in advance.
Solution 1:[1]
There are some options that are similar to auto-assign but require Premium or Ultimate plans (they're not available for free plans).
First, you'll have to set up Code Owners to your project. Code Owners are people or groups that you can tie to your project's files so developers / anyone modifying that file can know who to go to for help or problems.
To setup Code Owners you add a CODEOWNERS file to either:
- your project root directory
- the
.gitlabdirectory in your project root - a
docsdirectory in your project root
The file syntax looks like this:
# Code Owners for a file
filename @username1 @username2
# Code Owners for a directory
directoryname/ @username1 @username2
# All group members as Code Owners for a file
filename @groupname
# All group members as Code Owners for a directory
directoryname/ @groupname
Next you'll have to setup Approval Rules for your Merge Requests.
To add Code Owners as Merge Request approvers, go to your project Settings -> General, expand Merge request (MR) approvals, locate Eligible Users and add how many approvals you require. Eligible Users in this context equates to Code Owners.
For more information you can view the Code Owners docs, Merge Request Approval Rules docs, and adding Code Owners as approvals for changes to protected branches.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adam Marshall |
