You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Get Pull Request Participants from Repository


Get Pull Request Participants from Repository.


As a global administrator, I want to get all pull request participants from my Bitbucket repository to improve traceability of who is contributing with my repositories. I can run this script to show a list of Bitbucket ApplicationUser.

Good to Know

  • This script must be executed in the Script Console by someone with at least global administrator permission.


  • Bitbucket Bitbucket (6.3 - 7.12)
  • ScriptRunner for Bitbucket ScriptRunner for Bitbucket (6.11.0)
import com.atlassian.bitbucket.pull.PullRequestService import com.atlassian.bitbucket.pull.PullRequestParticipantSearchRequest import com.atlassian.bitbucket.pull.PullRequestRole import com.atlassian.bitbucket.repository.RepositoryService import com.atlassian.bitbucket.user.ApplicationUser import com.atlassian.bitbucket.util.PageUtils import com.atlassian.sal.api.component.ComponentLocator def final PROJECT_KEY = 'SR' def final REPO_KEY = 'scriptrunner' def final PAGE_SIZE = 1000 def repositoryService = ComponentLocator.getComponent(RepositoryService) def pullRequestService = ComponentLocator.getComponent(PullRequestService) def repository = repositoryService.getBySlug(PROJECT_KEY, REPO_KEY) def pullRequestParticipantSearchRequest = new PullRequestParticipantSearchRequest.Builder() .fromRepository(repository) .role(PullRequestRole.AUTHOR) .build() def participants = PageUtils.toStream({ pageRequest -> pullRequestService.searchUsers(pullRequestParticipantSearchRequest, pageRequest) }, PAGE_SIZE).collect { it as ApplicationUser } participants
Discovered an issue? Report it here

Suggested for you