I am creating some scripts to perform various checks when pull request is created and I've had some trouble getting a list of commits for the pull request.
the script is triggered on a PullRequestOpenRequestedEvent and needs to get a list of commits as part of the check.
my understanding is that I should be done something like
def pr = event.PullRequest
def cbrb = CommitsBetweenRequest.builder(pr)
def cb = cbrb.build()
but when I run this I get an error in the server logs
.o.s.b.DynamicEventListenerInvoker Event handler failed: event: com.atlassian.bitbucket.event.pull.PullRequestOpenRequestedEvent file: test/test.groovy
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.bitbucket.commit.CommitsBetweenRequest.Builder() is applicable for argument types: (com.atlassian.stash.internal.pull.InternalPullRequest) values: [InternalPullRequest{id=0, title=commit to test}]
at RepoFilter.in_list(test.groovy:61)
at RepoFilter$in_list.call(Unknown Source)
at test.run(test.groovy:74)
If I try switching to the repos associated with the pull request I get a similar error
c.o.s.b.DynamicEventListenerInvoker Event handler failed: event: com.atlassian.bitbucket.event.pull.PullRequestOpenRequestedEvent file: test/test.groovy
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.bitbucket.commit.CommitsBetweenRequest.Builder() is applicable for argument types: (com.atlassian.stash.internal.repository.InternalRepository) values: [DEVOPS/updated-workflow-test[204]]
at RepoFilter.in_list(test.groovy:61)
at RepoFilter$in_list.call(Unknown Source)
at test.run(test.groovy:74)