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

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

0 votes
Robert Giddings _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 26, 2022

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

Robert Giddings _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 27, 2022

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

I have a PR with some Merge Checks and Listeners in ScriptRunner on Bitbucket Server.
That works fine so far - when the PR is initially created, some people are added as mandatory and optional, depending on some conditions (e.g. frontend code versus backend code in the same git repo for example).

 

Now I would like to add additional reviewers later, e.g. in a second step - only AFTER at least one member of a first group of reviewers has approved a PR.

I explicitly don't want to add all the reviewers at once during PR creation (to reduce the noise in their inboxes), but want to update them later based on a condition.


I did the same with Listener dynamically-add-reviewers-to-a-pull-request and a condition
and the new additional mandatory reviewers get added to the PR
e.g. by calling

addMandatoryUsers("user", "userB")

 But they are then not added to the list of reviewers shown in the web UI e.g.
/projects/PROJECTKEY/repos/REPOKEY/pull-requests/12345/overview
in the top right and also get no email.

Instead, the message is
userA and userB are mandatory reviewers for this pull request, they must be added as reviewers before this pull request can be merged.

So is there a way to add reviewers later, so that the show up in the reviewers list in the UI, and get notified automatically?
It's very cumbersome for the PR creator to have to add them all manually.

Note: the above is independant of who the actual approvers are, as I am checking that with custom merge checks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events