I am trying to have a rule wherein if the ticket isn't in the correct status when the pull request is created, a comment is added addressing the pull request creator to transition the ticket in correct status. However, I am unable to derive the name of the pull request creator using smart value tags. I tried {{pullRequest.creator}}, {{pullRequest.author}}, {{issue.development.pullRequest.creator}} and so on but with no success
Hi @Meghanand Baraskar ,
I recently had the same issue with another question : https://community.atlassian.com/t5/Jira-Software-questions/Automation-Trigger-Who-Runs-Flow/qaq-p/1586669
The answer is : not possible yet, but there's a feature logged for this https://codebarrel.atlassian.net/browse/AUT-1997
Let me know if this helps,
--Alexis
It's a little ugly, but I think you could do a Web Request to get this.
You'd need to take your {{pullRequest.url}} and use some text manipulations to change it into the appropriate API call (depends on your Git server - you'd also have to set up a service account/token etc etc). For Bitbucket Server, this seemed to work:
$SERVER/rest/api/latest/projects/$PROJECT/repos/$YOURREPO/pull-requests/4
This returned a nice bit of JSON, and you would then be able access the User account, display name, and email thusly:
{{webhookResponse.body.author.user.name}}
{{webhookResponse.body.author.user.displayName}}
{{webhookResponse.body.author.user.emailAddress}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Darryl Lee for your response. I am however, not quite familiar with how to go about doing what you have suggested. We too are using Bitbucket but I don't know what I can do with the URL I get from {{pullRequest.url}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, sorry, I should have provided some references and a little more explanation.
What I'm cavalierly suggesting (without testing) is that you use the Send outgoing web request action to talk to the Bitbucket API which contains a call that should let you get information about a Pull Request.
The idea is that you'd take the {{pullRequest.url}} and use some of the Smart Value text functions to rewrite it into a URL that you could use to make a call to the the Bitbucket API to obtain the Author info.
So if {{pullRequest.url}} is this:
https://YOURSERVER/projects/YOURPROJECT/repos/YOURREPO/pull-requests/7
You could a use:
{{pullRequest.url.replace("/projects/","/rest/api/latest/projects/")}}
To get to:
https://YOURSERVER/rest/api/latest/projects/YOURPROJECT/repos/YOURREPO/pull-requests/4
So you would put that bit with the replace into the Webhook URL field.
The trick here is that to talk to your Bitbucket server, you'll need to be authenticated.
I found this old post that makes it sound like Basic Auth should work with username/password, but you really should instead create a Personal Access Token.
ANYWAYS, once you set up a token, you'll follow steps similar to these:
Automation for Jira - Send web request using Jira REST API
But instead of the Jira REST API, you'll be talking to the Bitbucket API, again, using the generated URL above.
Here's another good reference to what we're trying to do here, although in this example, they don't need to deal with authentication:
Send Web Request Action now Provides Response Data
Anyways, unfortunately this is all theoretical. I don't have any projects with active Pull Requests where I can test this kind of thing. Has anyone else ever done this in real life?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.