Jira Custom Fields to Github Labels

Originally asked by Juan Grases on 23 October 2020 (original question)


I want to create labels on Github based on a Jira custom field value, how can I do that?


Answer by Juan Grases on 23 October 2020

Jira Outgoing sync:

replica.customFields."CF name" = issue.customFields."CF name"

Gitub Incoming sync:

def CfToLabel = ["Cf Value A": "Label1", "Cf Value B": "Label2"]

def remoteValue = replica.customFields."CF name"?.value
def localLabel = nodeHelper.getLabel(CfToLabel[remoteValue])
if(localLabel && !issue.labels.contains(localLabel)){
  issue.labels += localLabel
}


That should work!