Is there a way to access the list of all synced tickets with their IDs or links in Exalate and use that list to replace GitHub link/ ID with a Jira link/ ID?
Specifically, when there is a comment from GitHub with a link to an Issue or PR I would like to somehow replace the link with a related Jira ID (or link to the ticket in Jira).
So for example someone in GitHub adds the following comment:
Answer by Francis Martens (Exalate) on 10 January 2021
Hi Daniel Szewczyk
Sorry for the delay here
Using a regular expression, it is possible to match any reference (in the format #<number>) in a comment with the twin issue using the nodeHelper.getLocalIssueFromRemoteUrn
By adding the logic to the closure of the mergeComment, it is possible to process all the comments.
The code looks like this
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
// match any #<number> in the comment
def matcher = comment.body =~ /\#(\d+) /
def newCommentBody = comment.body
matcher.each {
match ->
// for each reference match - look up the number and check for the twin
targetKey = nodeHelper.getLocalIssueFromRemoteUrn(match[1])?.key
if (targetKey) {
// if the twin is found, replace the reference.
newCommentBody = newCommentBody.replace(match[0],targetKey)
}
}
comment.body = newCommentBody
comment
})
The following video demonstrates how it works
Comments:
Daniel Szewczyk commented on 12 January 2021
Thanks again Francis for this perfect solution!
I just have one question regarding adding a way to filter out internal comments. Previously I used this one: