56

Is there a way I can make Jira ticket id's on Github link to Jira? (much the same way as how it happens on Bitbucket). Maybe there is a plugin or something I could use ?

EDIT:
I specifically want ticket id's in Github to link through to Jira, this is not described in any of the resources below:

Vitaly Zdanevich
  • 13,032
  • 8
  • 47
  • 81
Willem D'Haeseleer
  • 19,661
  • 9
  • 66
  • 99
  • possible duplicate of [How do I connect github to JIRA?](http://stackoverflow.com/questions/5421647/how-do-i-connect-github-to-jira) – ChrisGPT was on strike Apr 06 '15 at 16:09
  • See also https://confluence.atlassian.com/display/BITBUCKET/Linking+Bitbucket+and+GitHub+accounts+to+JIRA and https://help.github.com/articles/integrating-jira-with-your-projects/. A simple search of "github jira integration" found all of these. – ChrisGPT was on strike Apr 06 '15 at 16:09
  • 4
    @Chris The links you are providing describe how to setup the default integration of with JIRA. None of them describe how to enable JIRA links in github. Sorry I should have been more specific in what resources I had already consulted. – Willem D'Haeseleer Apr 06 '15 at 16:14

6 Answers6

85

Update 2022:

Dusan Plavak mentions in the comments that, as of today (Q1 2022), you can also import / automate creation of autolinks via github api.

You can also use gh api:

gh api repos/octocat/hello-world/autolinks \
       -f -q 'key_prefix:key_prefix url_template:url_template'

And since July 2022, you also have autolinks with alphanumeric IDs (for instance for a Trello card URL: https://trello.com/c/3eZr2Bxw).


2019: No need for Chrome plugin, Safari hack or scripts.

From October 2019, GitHub can automatically transform TICKET references to Jira links, for example.

See "Save time linking resources with autolink references" from Lars Schneider.

Now you can set up an autolink reference and GitHub will automatically create links (to external systems) for you.

https://i2.wp.com/user-images.githubusercontent.com/477434/66348334-994e1000-e956-11e9-8c87-9e871c221955.gif?resize=992%2C458&ssl=1

How it works

If you use GitHub with external services (like Jira), you might be familiar with shorthand references (like TICKET-123) to point to resources in those external systems.

Starting today, GitHub can automatically transform shorthand references into clickable links for GitHub Pro, Team, and Enterprise plans.

So not the regular github.com.

To enable this feature, a repository admin needs to register the reference prefix (such as TICKET-) in the settings.
Afterwards, references of that type are detected in issues, pull requests, comments, or commit messages, and turned into links.

This speeds up navigation between GitHub and external systems.

See documentation.

Note that the ticket prefix is not included in the hyperlink despite being included in the anchor text. The URL preview in the setting is accurate:

GitHub Autolinks are not so awesome for Jira

The animation in the feature announcement, replicated above, shows this limitation but not clearly.

This means that you have to either include the project key in the target URL as well or prefix all project keys with a another key and use that as the autolink prefix.

You cannot even use Git's trailers to reference tickets and use autolinks, because trailers are key-value pairs separated by : (colon space) and an autolink prefix that ends with a space is invalid.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The prefix is not included in the hyperlink, making this feature pretty awful for Jira specifically. The documentation hints at this. The announcement and animation suggests otherwise. – mkjeldsen Apr 12 '21 at 08:33
  • @mkjeldsen That seems a problem... Can you edit this answer with a screenshot illustrating that issue in your case? – VonC Apr 12 '21 at 08:40
  • Hello, just small update. As of today you can also import / automate creation of autolinks via github api https://docs.github.com/en/rest/reference/repos#autolinks – Dusan Plavak Mar 31 '22 at 19:34
  • @DusanPlavak Thank you. I have included your comment in the answer for more visibility. – VonC Mar 31 '22 at 21:31
13

I decided to make a Chrome extension for this ! This extension works on all websites, not just Jira ! :D

Install it here:
https://chrome.google.com/webstore/detail/jira-hotlinker/lbifpcpomdegljfpfhgfcjdabbeallhk

Source code:
https://github.com/helmus/Jira-Hot-Linker

Willem D'Haeseleer
  • 19,661
  • 9
  • 66
  • 99
0

If you mean the commit message for commit e0d9e32 shows TEST-1234 Fixed this really bad bug and you want TEST-1234 to link to http://www.your-jira.com/browse/TEST-1234 then no it does not look like this is possible.

You could look to do a Chrome/Firefox browser plugin that accomplishes the behavior you desire. (Scans the webpage looking in certain sections for JIRA Key's and then updates them to links)

Welsh
  • 5,138
  • 3
  • 29
  • 43
0

I wrote a site specific Safari hack. It requires you to install it yourself, but that gives you the opportunity to read the code (it's short!) first. https://github.com/unicode-org/icu-jira-safari

  • it fetches elements of class commit, gh-header-title, and js-issue-row with getElementsByClassName()
  • then, for anything such as ICU-1234 (our Jira project id), it creates a link to the appropriate URL on the Jira server.

I wanted to include Jira issue status as well, but Atlassian Cloud CORS settings prevent that.

Here is an example if the linkification (ICU-10464 turns into a link on the right hand side).

screenshot example

Steven R. Loomis
  • 4,228
  • 28
  • 39
  • 1
    Please don't just post some tool or library as an answer. At least demonstrate [how it solves the problem](http://meta.stackoverflow.com/a/251605) in the answer itself. – Blue Jul 25 '18 at 20:39
  • Fair enough @FrankerZ — added some explanation of how I did it. – Steven R. Loomis Jul 25 '18 at 20:50
0

Someone made exactly what I wanted coming from gitlab.

https://chrome.google.com/webstore/detail/linkify-jira-issues/ekbbnaokafbanjgmcbllligemhiclbcb

This updates the text in my github PRs to convert them in clickable links.

Vishwanath
  • 6,284
  • 4
  • 38
  • 57
0

I made a super simple Chrome extension for this. It simply adds a link to the relevant JIRA ticket on your Github pull request page in a non-obtrusive way (See screenshot below)

Install it here: https://chrome.google.com/webstore/detail/github-to-jira/dhnagjladcclacjnccpnibdmkljidnhl?hl=en-GB

Source code here: https://github.com/mfalade/github-to-jira

While Github Autolink is an awesome solution, this is easier to use for the following reasons.

  • You don't need to provide a description with ticket number for this to work. It automatically derives ticket number from your branch name.

  • You don't have to configure anything on the Github admin page. Perfect for users who don't have admin privileges

  • You can work on multiple projects or teams more easily. Supports multiple ticket prefixes.

  • This extension works for all project management tools you might want to link to

enter image description here

mfalade
  • 1,647
  • 2
  • 17
  • 16