Automation to assign PR reviewer
Asked by Nishanth Korupolu:

Is there a way to assign a reviewer to a PR automatically when a PR is created?


Answers:
author: Caterina Curti
body: Hi,

I wrote an app that you can check out, install and customize (all of this for free) to assign reviewers when the PR is created.

Here is the full article covering the app: [Assign PRs randomly to a specific list of users in Bitbucket Cloud](https://community.atlassian.com/t5/Bitbucket-articles/Assign-PRs-randomly-to-a-specific-list-of-users-in-Bitbucket/ba-p/2489254)

And this is just to explain the logic of adding a reviewer to the PR: [Add a reviewer to a PR using the REST API and Forge](https://community.atlassian.com/t5/Bitbucket-articles/Add-a-reviewer-to-a-PR-using-the-REST-API-and-Forge/ba-p/2495708)

<br />

<br />

Would love to know if you use it or customize it for your own team requirements.

Cheers,  
Caterina


author: Ulrich Kuhnhardt _IzymesCo_
body: Hi [@Nishanth Korupolu](/t5/user/viewprofilepage/user-id/5230341)

As [@Sachin Dhamale](/t5/user/viewprofilepage/user-id/785689) has mentioned you can define PR default reviewers in repository settings. The reviewers will be added to every pull request. Groups cannot be configured, only individual users.

If you like to add groups as reviewers you can use an app like [Workzone for Bitbucket cloud](https://marketplace.atlassian.com/apps/1211303/workzone-pullrequest-workflow?hosting=cloud&tab=overview) which gives you more flexibility and control how reviewers are added to PRs. You can define multiple rules based on the following parameters:

* PR destination and source branch -- you may have different reviewers/group for PRs to develop, or release or main
* File/module paths -- you may have different reviewers/groups for src/server/\*\*, src/client/\*\*, or \*\*/test/\*\*
* Require N approvals per rule
* Require successful builds, complete tasks etc

Workzone can also block merging the PR until all approvals for each applicable rule are given. You can even enable auto-merge so Workzone merges the PR as soon as all rule conditions are met.

I hope this helps!

Best, Ulrich

// [Izymes](https://marketplace.atlassian.com/vendors/1210584/izymes-pty-ltd)

Disclaimer: I represent Izymes. We make awesome tools for efficient development teams.


author: Sachin Dhamale
body: [@Nishanth Korupolu](/t5/user/viewprofilepage/user-id/5230341) ,

Welcome to the Atlassian community !!

Can you provide more info on this is it ?

comments: author: Nishanth Korupolu
body: Sure,  

I want to make an automation such that when a new PR is raised, the PR reviewer is assigned automatically from a group a pre-selected users.

I just want to assign the PR to the reviewer automatically. The PRs should be distributed evenly if possible amongst these pre-selected users.


author: Sachin Dhamale
body: What is PR here?


author: Nishanth Korupolu
body: PR is Pull Request


author: Sachin Dhamale
body: [@Nishanth Korupolu](/t5/user/viewprofilepage/user-id/5230341)

You can use the Script Runner for Bitbucket Plugin there you can have option to add the auto reviewer to the pull request.

Refer [this](https://docs.adaptavist.com/sr4bib/6.20.0/features/listeners/built-in-listeners/auto-add-reviewers-to-a-pull-request)


author: Sachin Dhamale
body: [@Nishanth Korupolu](/t5/user/viewprofilepage/user-id/5230341)

There is Default Reviewer option is also there


Tags: bitbucket-cloud

cloud

jira