Set default reviewers for merge request in GitLab

Viewed 2919

How I can set default reviewers in GitLab Premium?

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

4 Answers

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.

If you have the proper permissions (I believe you have to be a Maintainer of the project), then you should expand that Merge request approvals section. There is a place to edit the Default approvers there.

Edit Default Approvers

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.

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.

Related