Github label cannot be set by Jira issue type and vice versa

Answer by Mathieu Lepoutre on 16 October 2023

Hi Thorsten,

The issue is ‘labels’ is an array and not a string. Therefore, using the entire ‘labels’ array to map and set ‘issue.typeName’ won’t work as expected

Please try this in Jira incoming sync:

if(firstSync){
   replica.labels.each {
      def mappedTypeName = typeMapping[it.label]
      if (mappedTypeName) {
         issue.typeName = mappedTypeName
         return
     }
   }
}

This will set the issue type in Jira base on the first matching label it finds in the GitHub issue.

For the Github query, please try this in Github incoming:

if(firstSync){
  def remoteTypeName = replica.issueType.name
  issue.labels += nodeHelper.getLabel(typeMapping[remoteTypeName])
}

This will add a label to the GitHub issue based on the issue type from Jira.

Thank you.

Kind regards,
Mathieu Lepoutre