Willem D'Haeseleer
Willem D'Haeseleer

Reputation: 20190

Make Jira links clickable in Github

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:

Upvotes: 61

Views: 36431

Answers (6)

VonC
VonC

Reputation: 1329032

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.

Upvotes: 95

mfalade
mfalade

Reputation: 2147

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

Upvotes: 0

Willem D'Haeseleer
Willem D'Haeseleer

Reputation: 20190

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

Upvotes: 15

Vishwanath
Vishwanath

Reputation: 6004

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.

Upvotes: 0

Steven R. Loomis
Steven R. Loomis

Reputation: 4350

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

Upvotes: 0

Welsh
Welsh

Reputation: 5468

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)

Upvotes: 0

Related Questions