š„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.