đ„Letâs Do DevOps: Creating 60k GitHub Auto-Link References to Jira
--
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
Hey all!
GitHub is a fantastic place for code, but probably isnât where youâre managing your ticket queue, right? You could use GitHub Issues to keep track of specific issues with a code-base, but your project manager isnât going to be happy with that â theyâd much rather see an aggregate queue of work on all the different team boards in something like Atlassianâs Jira ticketing system.
So all the work comes from Jira, and is implemented in GitHub. Those ticket numbers are all over your code commits, your PR comments, and your git history.
And GitHub has a tremendously useful feature that helps you find your way back to Jira â itâs called an auto-link reference, and it means once configured on a repo, any string in any context (commit message, comment, PR message, etc.) will become a hyperlink and link back to your ticketing system! That could save a heck of a lot of time.
Unfortunately it doesnât live within an Org configuration â it lives at the Repo level. I have 42 ticket projects to watch for, and I have 1,426 repositories to configure.
That means I need to deploy 59,892 auto-link references. Holy moly.
Weâre not going to click our way through that. Letâs write some automation.
Loop Through all the Repos In Your Org
Since all these settings are at the repo level, rather than the Org level, we need to iterate through each repo. I wrote about this in a recent blog, but letâs pull out just the things we need. First, we need to count how many repos we have.
On line 2, we do an authenticated REST call to get all the Organization-level info, including Repo Type counts. We lookup the private counts (line 9) and public cout (line 10), and then add them together on line 11.