# Jira to Github Comment Impersonation and reference Issue key

**URL:** https://community.exalate.com/t/jira-to-github-comment-impersonation-and-reference-issue-key/4668
**Category:** General Questions
**Tags:** usecase, jira, github, migrated\_question, moved
**Created:** [November 4, 2024, 7:15am UTC](https://community.exalate.com/t/jira-to-github-comment-impersonation-and-reference-issue-key/4668 "2024-11-04T07:15:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 7:15am UTC](https://community.exalate.com/t/jira-to-github-comment-impersonation-and-reference-issue-key/4668/1 "2024-11-04T07:15:03Z")

</div>

_Originally asked by John Smith on 06 April 2021 [(original question)](https://oldcommunity.exalate.com/questions/25071136)_

* * *

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

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 4, 2024, 7:15am UTC](https://community.exalate.com/t/jira-to-github-comment-impersonation-and-reference-issue-key/4668/2 "2024-11-04T07:15:04Z")

</div>

_Answer by Ariel Aguilar on 06 April 2021_

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:

```auto
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

* * *

---

<div class="post-metadata">

### Author: ![xl8bot](https://dub1.discourse-cdn.com/flex018/user_avatar/community.exalate.com/xl8bot/32/324_2.png) [@xl8bot](https://community.exalate.com/u/xl8bot)
#### Post date: [November 6, 2024, 7:15am UTC](https://community.exalate.com/t/jira-to-github-comment-impersonation-and-reference-issue-key/4668/3 "2024-11-06T07:15:27Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
