After creating PR, post URL into comment Automation
Asked by Vanessa:

Hey there,

I wanted to create an automation regarding the following:

- When a Pull Request is created, post a comment with the URL of the Pull Request into the comment of the Jira issue

- If a Code Reviewer is already added, mention the Code Reviewer in the comment too.

We have the following field (?) in the Jira Screen that already shows that there is a pull request but it would also be needed in the comment.

![Bildschirmfoto 2022-09-13 um 15.48.31.png](https://community.atlassian.com/t5/image/serverpage/image-id/215736i1BC5B470B79EFD58/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-13 um 15.48.31.png")

Maybe someone has a easy solution for this :)

Thank you already in advance!  
-Vanessa


Answers:
author: Patrik Korovsky
body: Hi [@Vanessa](/t5/user/viewprofilepage/user-id/4741105)

You can create a simple automation, for example (first part is optional):

Hi \[\~accountId:{{assignee.accountId}}\],

A new PR is ready for you {{pullRequest.url}}!

![PR.png](https://community.atlassian.com/t5/image/serverpage/image-id/215757iA86B9096E7677138/image-size/large?v=v2&px=999 "PR.png")  

You can read more about development smart values here: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-development/>

comments: author: Stefan Salzl
body: to the answer of of [@Patrik Korovsky](/t5/user/viewprofilepage/user-id/4896461) i'd like to add:

The reviewer of a PR could be another person than the assignee. The reviewer is something living within the repository and is not connected to any increment in Jira (not even a user ---\> could be at least it doesn't have to).

Furthermore there is no smart value to retrieve the PR reviewer. To achieve this (i know in github) a webrequest could be sent to get this information via Rest API.

Best  
Stefan


author: Vanessa
body: Hello,

so in general it works, but a small thing I do not want the Automation to take the Person from the Assignee field but from the field "Code Reviewer":

![Bildschirmfoto 2022-09-14 um 13.09.47.png](https://community.atlassian.com/t5/image/serverpage/image-id/215967i0EDAA733BB913815/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-14 um 13.09.47.png")

Our field is written this way:

![Bildschirmfoto 2022-09-14 um 13.09.53.png](https://community.atlassian.com/t5/image/serverpage/image-id/215968i6A3BA28F4FF8C750/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-14 um 13.09.53.png")

In the Automation I wrote it like this:

![Bildschirmfoto 2022-09-14 um 13.10.21.png](https://community.atlassian.com/t5/image/serverpage/image-id/215970i8DD846267D55B61D/image-size/large?v=v2&px=999 "Bildschirmfoto 2022-09-14 um 13.10.21.png")

Do I need to name it Code Reviewer.accountID ?

<br />

Or why would it not put the Code Reviewer in the comment? (The field is filled out, I just used an empty example picture here)

Thank you!


author: Patrik Korovsky
body: Hello [@Vanessa](/t5/user/viewprofilepage/user-id/4741105)

As Stefan mentioned, the "Code reviewer" feature does not exist natively in Jira. So I assumed the next best thing is assignee.

Since you created a custom field, yes, you can use it instead of "assignee". I don't think you can use "Code Reviewer.accountID", but you can get the id for the custom field: "Hi \[\~accountId:{{customfield_XXXX.accountId}}\]", where XXXXX is the custom field id.

![customfield.png](https://community.atlassian.com/t5/image/serverpage/image-id/215983iEA458C58E252F27E/image-size/large?v=v2&px=999 "customfield.png")

You can find the id by following this guide <https://confluence.atlassian.com/jirakb/how-to-find-id-for-custom-field-s-744522503.html>

Cheers,  
Patrik


Tags: automation

cloud

jira-cloud

pull-request