I am using Adpatavist ScriptRunner.
I want to get the email address of whoever raised a pull request, as part of an Event Handler (so it can be sent on to Jenkins)
This is the code I have got to:
PullRequestOpenRequestedEvent event = (PullRequestOpenRequestedEvent)event
def pullRequest=event.getPullRequest()
def email = pullRequest.getAuthor().getUser().getEmailAddress()
If I just look a the pull request in JSON via the API I can see the email address I want to get
"author": {
"user": {
"name": "myname",
"emailAddress": "myname@test.com",However, when I do this I get the following error in the logs:
192.168.1.1,127.0.0.1 "POST /projects/XXX/repos/YYY/pull-requests HTTP/1.1" c.o.s.b.DynamicEventListenerInvoker Event handler failed: event: com.atlassian.bitbucket.event.pull.PullRequestOpenRequestedEvent file: <inline script>
java.lang.IllegalStateException: Pull request author could not be found in its participants
at com.atlassian.stash.internal.pull.InternalPullRequest.getAuthor(InternalPullRequest.java:192)
at com.atlassian.bitbucket.pull.PullRequest$getAuthor.call(Unknown Source)
at Script937.run(Script937.groovy:20)
Participants is an empty object in the API, and never seems to have anything in it (even when I add reviewers etc)
Am I just missing something fundamental with the API calls? Is my Bitbucket server configured incorrectly?
Any ideas appreciated