Hi,
I know how to add PR reviewers to Bitbucket using REST api, but I'd like to do it via ScriptRunner (b/c I want to Add Mandatory Reviewers as well)
So I am wondering how one can add a PR Reviewers using ScriptRunner programmatically, including Mandatory Reviewers,
Would it be a REST call from a 'Customer Event Handler' (on PullRequestOpen event)?
Best Regards
ED
Hi @erikvdibble,
This is quite simple. scriptrunner has a built-in-function for the same
To achieve this Repository Settings --> Script Event Handlers --> Add Reviewers to pull requests --> fill the fields and add it
Hope this helps
BR,
Leo
Thanks Leo.
I know that way. But that's what I want to avoid -- the UI. We have so many events I'd prefer not having to add these manually.
Looking for a way to do:
Repository Settings --> Script Event Handlers --> Add Reviewers to pull requests --> fill the fields and add it
from a script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @erikvdibble ,
Does configuring the "Auto add reviewers to pull requests" event handler at the global admin level help reduce your manual workload? You don't need to configure this event handler for each Repo individually.
Please let me know if you still require help with a custom Event Handler?
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem - we want to Auto-Add Reviewers based on naming patterns:
The "Auto add reviewers to pull requests" doesn't work, because for each Bitbucket Project, there's a different AD Group that should be the mandatory reviewers. Our use-case is that each Project has independent DBAs. So for certain changelog files, we need to add that Bitbucket Project's DBAs as Mandatory Reviewers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sean Dukehart ,
I believe that the current "Auto-Add Reviewers to Pull Requests" (https://scriptrunner.adaptavist.com/latest/bitbucket/StashEventHandlers.html#_auto_add_reviewers_to_pull_requests) implementation for ScriptRunner for Bitbucket should answer your requirements, except responding to the PullRequestRescopedEvent I believe.
You should be able to use the "Condition" field to address the point about the PR containing certain files.
And you should be able to set up different "Auto-Add Reviewers to Pull Requests" listeners for each set of Projects that needs a different set of Mandatory reviewers.
If the built-in listener still does not meet all your requirements, ScriptRunner for Bitbucket gives you the ability to create your own event listeners (https://scriptrunner.adaptavist.com/latest/bitbucket/StashEventHandlers.html#_working_with_custom_listeners) allowing you to do pretty much anything you want directly with the Bitbucket API.
I hope this helps answer your question?
If you need any additional help, please let me know?
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Robert Giddings _Adaptavist_ - thanks for the input. Unfortunately, setting up different "Auto-Add Reviewers to Pull Requests" listeners for each set of Projects that needs a different set of Mandatory reviewers isn't really feasible; there are just too many Projects for us to go about doing this.
Using the custom listener approach, the Bitbucket APIs don't seem to facilitate:
However, the "Auto-Add Reviewers to Pull Requests" listeners do have these abilities. So does it utilize additional Adaptivist APIs or use different hooks?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sean Dukehart ,
Sorry for the late reply.
I'm going to reach out to you privately so I can discuss your requirements in further detail with you.
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.