Script Runner : Merge Checks Issue

Varun August 13, 2019

Hello, 

I have been using Script runner to Restrict the Merge unless some conditions are met. I am using this in built script under conditional merge checks : 

  • At least one user from the experienced developers group has approved

 

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.bitbucket.user.UserService

def userService = ComponentLocator.getComponent(UserService)
mergeRequest.pullRequest.reviewers.findAll { it.approved }.any {
userService.isUserInGroup(it.user, "experienced-developers")
}

 

My use Case : 

 

Step 1: Created a Group and have added user1 and user2 to the group  "experienced-developers"

Now, when a different user named as userA raised a pull request unless either of one user1 and user2 doesnt approve the code the merge should be disabled. 

 

 

Note: I can do this by placing user1 and user2 as mandatory reviewers but we dont want to do that instead we want to do this using the conditional merge checks. 

 

Please help me .  

 

 

 

1 answer

0 votes
Mary Wilson January 16, 2020

Did you find an answer to this?  I'm struggling with the same issue and can't seem to get it to work correctly.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events