12

How I can set default reviewers in GitLab Premium?

In Settings → General I have only Merge request (MR) approvals, not reviewers.

leusrox
  • 1,855
  • 3
  • 10
  • 17

4 Answers4

9

There is no such setting in the UI. If you think it would be useful to others, please file a feature request.

As a workaround, you could use the Merge requests API to set reviewers when creating the MR or by updating it after creation.

How you want to achieve the desired result depends on your workflow.

For example, you could have something subscribe to the project webhook which triggers a script that does the API call whenever it sees an open MR event.

Another option, if you run pipelines on MRs, you can have a job run a script which could set reviewers if none are already set via the API.

Yet another option would be to have a specified reviewer set when a merge request is created through the /assign_reviewer @user quick action by adding it to the default and all MR template files.

Arty-chan
  • 2,572
  • 1
  • 19
  • 25
6

You can use "Default description template for merge requests" either via Settings->Merge Requests or via file in .gitlab/merge_request_templates to do it via a workaround. (Doc)

In the template you can use the chat code

/assign_reviewer @user1 @user2 @user3

to automatically assign user1, user2 and user3 as reviewers when creating a new MR.

Seega
  • 3,001
  • 2
  • 34
  • 48
3

Might be a useful workaround as this does not add you as a reviewer. (especially for gitlab free/CE 14.8+, as multiple reviewers are only available for Premium)

You could add a Reviewers section to your default MR template. Then persons will be notified with a Todo for the MR upon creation.

This should be in your default branch.

.gitlab/merge_request_templates/default.md


## What this MR does / why we need it 
- description
- proof of work


## Reviewers

- [ ] Reviewed by @gitlabUser1
- [ ] Reviewed by @gitlabUser2
- [ ] Reviewed by @gitlabUser3
- [ ] Reviewed by @gitlabUser4
- [ ] Reviewed by @gitlabUser5

Thanks for your MR, you're awesome! :+1:

The user can then check the checkbox upon review which will change the MR history too.

Tjad Clark
  • 552
  • 3
  • 17
  • 1
    This is the perfect solution for those without Premium license. Or even with one, this is still a good way to visual it. – Shinigamae Jul 06 '23 at 03:14
-4

Could you please try below

In Settings-->General-Merge Request Approvals. enter image description here

Click on Add approval Rule.

enter image description here

Add Rule name as "Default", Approvals required, desired branch and add members under approvers.

These approvers would be your default reviewers for any Merge request.

Sandeepp
  • 24
  • 3
  • 3
    That is not what this does. This would simply mean that 1 approval would be required from someone on your list. This does not pre-fill the reviewers on a new MR. – robross0606 Mar 31 '22 at 17:52