How to sync multiple Github Pull request to single Jira issue

Originally asked by Varun Joseph Allu on 03 October 2022 (original question)


Hi Team ,

We have a business requirement to sync multiple Github Pull Request to Single Jira issue.Is that possible ?
If possible please help with your inputs.

Thank you,
Varun


Comments:

Ariel Aguilar commented on 05 October 2022

Hi Varun,

In this example, we are going to set a connection from GitHub to Jira Server. And sychronize multiple pull requests to a single Jira issue.

GitHub Outgoing:

In the GitHub pull request, you add on the description the Jira issue (For example: TEST-123) you want to connect to.

replica.key            = issue.key
replica.summary        = issue.summary
replica.description    = issue.description
replica.labels         = issue.labels
replica.comments       = issue.comments
replica.type           = issue.type  

After you Exalate the ticket in GitHub (You could manually do it using Entity sync status or set a trigger to match the criteria and use something like:

repo:Exalate-Team/Test is:pr label:exalate

Jira Incoming:
This script will be executed in Jira Server. It will connect the corresponding tickets.

def remoteIssueUrn = replica.description
  if(remoteIssueUrn && firstSync){
   def localIssue = com.atlassian.jira.component.ComponentAccessor
  .issueManager
  .getIssueObject(remoteIssueUrn)
  if(localIssue == null) throw new com.exalate.api.exception.IssueTrackerException("Issue with key "+remoteIssueUrn+" was not found")
if(replica.type.name == "Pull Request"){
  issue.typeName = localIssue.type.name
  issue.projectKey = localIssue.projectObject.key   
  issue.id = localIssue?.id
  issue.key = localIssue?.key
  return;
  }
}
issue.summary      = replica.summary
issue.description  = replica.description
issue.comments     = commentHelper.mergeComments(issue, replica)
issue.labels       = replica.labels

And like this, you can connect multiple pull requests to the same Jira issue.
Kind regards,

Ariel

Varun commented on 31 October 2022

We faced this error when we tried the above script

exalate_support_githubnode_5.4.4_20221013-083625.zip (old community)

Answer by Varun on 07 November 2022

Hi Ariel,

We tried with the your script.
Not able to sync multiple PR’s with single Jira issue.
Are you able to do this in your system ?

Please help with your inputs on this.

Thank you,
Varun


Comments:

Ariel Aguilar commented on 07 November 2022

Hi Varun,

The suggested script was not found on the support logs you provided, could you set a video and share it to see what is not working?

Kind regards,

Ariel