Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,174
Community Members
 
Community Events
168
Community Groups

I am having trouble getting started with Scriptrunner.

I need to implement a workflow where I need

 

1. Validate whether approver and submitter of pull request are not same

2. Check the status and project details of the JIRA issue

What I have till now is the below

import com.atlassian.bitbucket.scm.pull.MergeRequest

def MergeRequest mergeRequest

def pullRequestDetails = mergeRequest.getPullRequest()
def pullRequestParticipantDetails = mergeRequest.pullRequest.getParticipants()

def reviewer = mergeRequest.pullRequest.reviewers.any {it.approved}
def user = mergeRequest.pullRequest.reviewers.any {it.user.name}

if (user == reviewer) {
mergeRequest.veto("Reviewer and User cannot be the same", "Need some one other than the user to approve")
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events