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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to generate pull requests via scriptrunner for bitbucket server?


Summary Question: Can I generate a pull request using scriptrunner for bitbucket server?


I am working on a certain workflow that requires PRs to multiple branches when a change needs to be made, and right now individuals must create all 3 PRs by hand (or in some cases with custom scripts that use bitbucket API).

I am interested in finding a way to generate 2 of the PRs when 1 is created, or perhaps I will decide to generate all 3 PRs based on some other event.

I learned from this page how to implement a custom listener:

However, my challenge is not on triggering the event, but it is in finding how to cause another event to occur, specifically the generation of a pull request.

I did find this:

which led me to this:

That gave me hope that maybe it was possible to do what I am trying to do, since this script also causes an event to occur.


I also consulted the atlassian documentation. There I found 2 docs that seemed to be a promising way to create a Pull Request using ScriptRunner.

Then search: "com.atlassian.bitbucket.pull"

From what I can see we would:

Use PullRequestService to create a pull request (interface).

Use PullRequestCreateRequest class as parameter for class that implements PullRequestService.


Unfortunately without any concrete examples, there will be a lot of trial and error and guessing how to put the pieces of this code together, and it might not work when all is said and done, but here's hoping!

Additionally, if you have other suggestions for accomplishing the same task, I would also welcome those suggestions. Any insight is greatly appreciated!

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,719 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you