Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

Jira to Github Comment Impersonation and reference Issue key

 
1
0
-1

What is the best way to accomplish comment impersonation and a reference from the issue key coming from Jira into GitHub?

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      The best way or workaround to accomplish comment impersonation and a reference key coming from Jira to Git hub can be sorted by adding the following code snippet into GitHub incoming script:


      import groovy.json.JsonSlurper
       
      if(syncRequest.remoteSyncEventNumber == 1L){
          def remoteKey = new JsonSlurper().parseText(syncRequest.replica.payload).get(replica.key)
          issue.comments = commentHelper.addComment("Remote key is ${replica.key} ", issue.comments)
      }
      //Above code will help on getting a comment with reference of the issue key by adding a comment with the issue key on first sync.
      issue.summary      = replica.summary
      issue.description  = replica.description
      issue.assignee     = nodeHelper.getUserByUsername(replica.assignee?.username)
      issue.reporter     = nodeHelper.getUserByUsername(replica.reporter?.username)
      issue.labels       = replica.labels
      issue.comments = commentHelper.mergeComments(issue, replica,                      
                          {
                             comment ->
                             comment.body =
                                "[" + comment.author.email + "] " +
                                comment.body + "\n" 
                          }
      )
      //This will help to add a reference from the email/author coming from Jira on each GitHub comment.


      Thanks,

      Ariel

        CommentAdd your comment...