Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,764
Community Members
 
Community Events
176
Community Groups

How to override default reviewers via scriptrunner

Hi,

I have a repo in bitbucket that have default reviewers with minimum required = 1.

Those default reviewers are defined under Repository Settings -> PULL REQUESTS -> Default Reviewers.

 

In addition I have Dynamically add reviewers to pull requests listener that add another default users to the PR but those users are not considered as 1 required approval for the PRS

How can I solve it?

 

Thanks

1 answer

Hi @nisha ,

Thank you for the post.

I am the Product Manager for ScriptRunner for Bitbucket.

First off, the native "Default reviewers" functionality found in Bitbucket's Repository Settings is independent from ScriptRunner for Bitbucket's "Dynamically Add Reviewers" or "Auto-Add Reviewers" (depending on which ScriptRunner feature you are using?).

An explanation as to why this is, is documented here: https://docs.adaptavist.com/sr4bib/6.43.0/features/listeners/built-in-listeners/dynamically-add-reviewers-to-a-pull-request and here: https://docs.adaptavist.com/sr4bib/6.43.0/features/listeners/built-in-listeners/auto-add-reviewers-to-a-pull-request

So, in order to resolve the issue you currently have, I would recommend the following:

1) Stop current use of the Bitbucket native "Default reviewers" functionality.

2) Use either ScriptRunner for Bitbucket's "Dynamically Add Reviewers" or "Auto-Add Reviewers". (Documentation links above).

3) Also use ScriptRunner for Bitbucket's "Require a Minimum Number of Approvers" as documented here: https://docs.adaptavist.com/sr4bib/6.43.0/features/script-merge-checks/built-in-merge-checks/require-a-minimum-number-of-approvers

However, one caveat to be aware of. ScriptRunner's "Require a Minimum Number of Approvers" currently will accept approval from any reviewer added to a Pull Request. I.e. those also added manually. Not just those reviewers added by ScriptRunner. This is something we might look to improve in the future.

In the meantime, does the proposed solution above meet your needs?

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket

Hi @Robert Giddings _Adaptavist_ thank you for your response.

What I did is as follow:

* Use "Auto-Add Reviewers" for mandatory and default reviewers, no conditions always the same reviewers

* Use "Dynamically Add Reviewers" for adding 3 more reviewers conditionally by files path 

* Use "Require a minimum number of approvers" set for 2

 

Want to make sure with you please that in this way PRs that do not include changes in specific files path will require 2 approvals according to the "Auto-Add Reviewers" script,

and PRs that do include changes in specific files will require 2 approvals according to the reviewers from both scripts "Auto-Add Reviewers" or "Dynamically Add Reviewers"

correct?

 

And another question what is the different between  "Auto-Add Reviewers" and "Dynamically Add Reviewers"?

 

Thank you

Hi @nisha ,

I believe what you have said is correct. However you might like to create a test repository to confirm the set-up works as you'd like.

Regarding your question, ScriptRunner for Bitbucket has had the "Auto-Add Reviewers" feature for a long time. But it uses Form widgets to select a static list of reviewers.

Users like yourself wanted more conditional control over when reviewers were added to Pull Requests, so we added "Dynamically Add Reviewers", to give users more control.

The outcome of both scripts is the same. I.e. a list of reviewers that automatically populate the Pull Request create screen.

Hope that helps answer your query?

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events