Bitbucket Merge Check script runner

Thejeswara Reddy R February 22, 2019

Hello All,

 

Here I have the code below which is not working properly.

 

import com.atlassian.bitbucket.pull.PullRequestParticipantStatus
import com.atlassian.bitbucket.scm.pull.MergeRequest
def mergeRequest = mergeRequest as MergeRequest
if (mergeRequest.pullRequest.reviewers.any { it.status == PullRequestParticipantStatus.NEEDS_WORK }) {
mergeRequest.veto("Please consult the reviewer.", "The merge is blocked by at least one reviewer.")
}

 

Kindly Help me ASAP!

Thanks in advance!

2 answers

1 accepted

1 vote
Answer accepted
Julius Davies _bit-booster_com_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2019

 

What version of Bitbucket are you on?   I don't think mergeRequest.veto() works on Bitbucket 6.

If you just want to block "Needs Work" pull-requests from merging, our Control Freak plugin provides that with just a few clicks:

 

needs-work.png

Thejeswara Reddy R March 4, 2019

Thanks for the response!

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 22, 2019

Hi Thejeswara, ee need more context to be able to help you:

  • Where is this code from?
  • What should it do? What result are you getting?
  • Which tools are you using?

Please give us a better description of your situation or environment, otherwise we have no idea to know what's going on.

Cheers,

Ana

Thejeswara Reddy R March 4, 2019

This script is about checking and blocking users until they wil get approval to merge the code on bitbucket branches.

 

It will be helpful if you forward this ticket to groovy script expert.

 

Thanks,

Thejes

Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2019

Hi Thejes, 

I'm afraid I won't be able to do that, as plugins are from third-party vendors. What you can do is to try to find the plugin vendor in our Marketplace section in Community, find them in the Marketplace and contact them directly, or let us know which plugin it is to see if someone with knowledge about it could help you.

Kind regards,

Ana.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events