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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Script Runner : Merge Checks Issue

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

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
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

273 views 2 5
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