Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner: how to check if a user from a specific reviewer group approved

Serkan Erdur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 23, 2026
Even if a user from XyzReviewers group approves this behaves like not, in a conditional merge check script.

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, "XyzReviewers ")
}

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
February 10, 2026

Hi @Serkan Erdur

You could try something like this:-

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

def targetGroup = "NameOfYourReviewerGroup"

def userService = ComponentLocator.getComponent(UserService)

def approvedBySpecificGroup = mergeRequest.pullRequest.reviewers.findAll { it.approved }.any { participant ->
userService.isUserInGroup(participant.user, targetGroup)
}

approvedBySpecificGroup

The example above is similar to the code you provided, with a minor modification.

Let me know how it goes.

Thank you and Kind regards,
Ram

Serkan Erdur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 17, 2026

I think it should return !approvedBySpecificGroup because merge is blocked if condition is true.
Nevertheless this changed nothing.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events