DEV Community

Cover image for Add magic links to GitHub: Jira, Zendesk and more
Davide 'CoderDave' Benvegnù
Davide 'CoderDave' Benvegnù

Posted on • Updated on

Add magic links to GitHub: Jira, Zendesk and more

Today we talk about a new feature of GitHub that not many people know about, the AutoLink References. I will show you how to automatically add links to external resources like JIRA issues and Zendesk tickets into your GitHub issues, pull requests, etc. using custom tags.

Video

As usual, if you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video with the whole explanation and demo, which to be fair is much more complete than this post.

Link to the video: https://youtu.be/ZoXiA_WyNzc

If you rather prefer reading, well... let's just continue :)

Autolinks?

You probably know that GitHub automatically creates links when a standard URL is typed or pasted into an issue or any other markdown field, and that it also creates links to other pull requests, Issues, and commits when you use the proper notation, like the # for referencing an issue.

What you probably don't know is that you can create your own shortcuts and automatic link creation for external resources.

If you use an external tool to track user-reported tickets, for example, you can reference a ticket number in the pull request you open to fix the issue. And this works basically with anything that is reachable via URL.

Create Autolink References

Let me show you how to do this.

Setting

First, we need to go to Setting, and where you have the Autolink References.

When there, you have a "Add Autolink Reference" button that, as the name says, lets you add a new one.

New Autolink

In the form you have to specify 2 things:

  • the prefix, or keyword, you wanna use
  • the link to your service

Note: the link must contain the variable <num> which will be replaced at runtime with the ID you are going to specify.

For example, in my case I want to link some Discord channel to my issues, so the configuration will look something like this:

New Autolink filled in

How to use them

Take a look at the video of the demo to see this in action

Now it's time to use our new autolink reference. As I've mentioned before, you can use it in any field that accepts markdown... but it is certainly most effective when used in Issues and PRs.

Just type your prefix, followed by the id of the resources (page, ticket, issue, etc...) you are going to reference. For my Discord example, something like this:

Issue

When the issue is saved, the Autolink Reference does its magic and "transforms" the shortcut in a full link as you can see here:

Transformed

Limitations and Notes

Cool right?

One thing you need to be aware of is that the ID of the resources you are trying to link using Autolink References has to be numeric. Currently alphanumeric IDs are yet not supported.

Also, it is worth mentioning that Autolinks are available in repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

Conclusions

Let me know in the comment section below what you think of the Autolink references.
For me it's a very cool feature and I can think of hundred different ways I want to use it.

Like, share and follow me 🚀 for more content:

📽 YouTube
Buy me a coffee
💖 Patreon
👕 Merch
👦🏻 Facebook page
🐱‍💻 GitHub
👲🏻 Twitter
👴🏻 LinkedIn
🔉 Podcast

Top comments (0)