Create
cancel
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

How to get the destiny branch of a PR using Atlassian SDK in Bitbucket Server Plugin?

I managed to implement "isAdminMergeCheck" following a tutorial: https://developer.atlassian.com/server/bitbucket/tutorials-and-examples/controlling-when-pull-requests-can-be-merged/

 

But for my check, I need to call this plugin only for certain branches (only for "master" and "develop"). Yet, using the Atlassian API, i can't get it. I tried using "getPullRequest().getToRef()" but I don't think it contains information about destiny branch. Or maybe I can't use it?

 

How to check destination branch in MergeCheck? Or how to call mergeCheck only for certain branches?

1 answer

0 votes
Yingran Sun Atlassian Team Apr 23, 2020

You can get the name of the destination branch of the pull request by using `request.getToRef().getId()` where `request` is your `PullRequestMergeHookRequest`.

Suggest an answer

Log in or Sign up to answer
TAGS
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,736 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