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 :
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 .
Did you find an answer to this? I'm struggling with the same issue and can't seem to get it to work correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.