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

Adding reviewers later to a PR using ScriptRunner Listener

M Bleyer August 8, 2023

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 managed to check the conditions in Merge Checks just fine, but both the built-in Listeners



only listen to two events



And these events do not get triggered when my PR gets updated (e.g. by someone from the first group approving), so my Listeners don't work because they never fire.

It also seems to me that both of these built-in Listeners are largely the same, so they are kind of redundant?

What I would need is a way to define my own list of events that trigger the Listener, like in the "Send Custom Email on Event".
Feature request for the product team: please add that possibility to the "Dynamically Add Reviewers to a Pull Request" built-in.

Alternatively, is there any other way to achieve the above?

describes a way to add a custom Listener, but I do not see that option in Bitbucket on my project level - is this a global Bitbucket admin feature? (e.g. can the global admin add additional custom event handlers/Listeners for everyone?)


Update: both Listeners auto-add-reviewers-to-a-pull-request and dynamically-add-reviewers-to-a-pull-request actually do seem to get triggered (surprisingly)
and the new additional mandatory reviewers get added to the PR
e.g. by calling

addMandatoryUsers("user", "userB")

 But they are not added to the list of reviewers shown in the web UI e.g.
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

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events