How can I send repository name from github to Jira Cloud

Originally asked by dongyo kang on 28 December 2022 (original question)


How can I send repository name from github to Jira Cloud?
I am trying to set up a single connection to handle multiple repository.
A single Jira project ↔ Multi repositories in Jira.
I checked entity from Jira but I don’t see repo’s name in JSON.
I currently recognize its repository by github’s label, but seems it’s not appropriate way to get it done.

Does anyone have an idea to get it done?


Answer by Dhiren Notani on 04 January 2023

Hi dongyo kang ,

Can you please try something like this?

GitHub Outgoing Sync
replica.repository = issue.repository

Jira incoming sync
if(firstSync)
{
if(replica.repository == “XYZ”)

{//set the Jira project key}
}

As Syed Majid Hassan rightly mentioned, this way you can use the value in an if block to take a decision as to what project this lands in and what issue type it is.

Thanks,

Dhiren


Answer by Syed Majid Hassan on 02 January 2023

Hi dongyo kang ,

If your replica received in Jira does not contains the repo name, you can add it to the replica from the Github outgoing script by adding the following:

replica.repository = issue.repository

Then, once you receive the repo information in Jira, you can use the value in an if block to take a decision as to what project this lands in and what issue type it is.

Please let me know if you have any questions.

Thanks

Majid