How to sync PR's id and PR status into customfield with hyperlink

Originally asked by Varun on 31 October 2022 (original question)


Hello Team,

We have a business requirement to sync multiple PR’s with single Jira issue and we want to update the Pull request details into custom field with hyper link.
Want to sync Pull request ID and Pull request Status into single Jira issue.

Please help with your inputs.

Thank you,
Varun


Answer by Dhiren Notani on 31 October 2022

Hi Varun Joseph Allu ,

I believe you are already sending the status information from your GitHub side as it is included in the default script configuration. If not, you can simply add this line of code on your GitHub outgoing side,

replica.status = issue.status

This is the payload information that I am sharing from the GitHub side. Now, for reference, we can use this information to map the status and also the GitHub PR url with some custom field in Jira.

So the incoming code on the Jira incoming sync would look like :

issue.customFields.“CF Name on Jira for Status”.value = replica.status.name

issue.customFields.“CF Name on Jira for PR URL”.value = remoteReplica.payload.issueUrl

Additionally, you can also map the statuses one-to-one with Jira issues. Please follow this document to know how.

Hope this helps.

Cheers!