šŸ”„Letā€™s Do DevOps: Get All GitHub Repo Branches (Even if thereā€™s Thousands)

Kyler Middleton
2 min readMar 27, 2023

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!

Iā€™ve been writing an ongoing project Iā€™m calling our GitHubCop ā€” itā€™s a tool that iterates over every repo we have (and we have thousands) and sets all the settings, branch policies, permissions, etc. on each of them every day.

Iā€™ve been primarily relying on GitHubā€™s REST API + a lot of clever bash tricks. It isnā€™t the most modern language, but it makes sense to me, and heck, it works. As Iā€™ve been developing the project Iā€™ve found a few rough edges, and I wanted to write about one of them I stumbled on recently ā€” grabbing a list of ALL the branches in a repo.

After all, we only want to set branch policies for branches that exist, right? So letā€™s talk about why this seemingly simple question isnā€™t simple, and how to solve it.

Iā€™ve Moved To Lets Do DevOps

From here on out, all content will be published on Lets Do DevOps for free. I want to give back to the community as much as Iā€™m able. Please subscribe there to avoid missing any content. Thanks all ā¤.

You can find this article here:

--

--

Kyler Middleton
Kyler Middleton

Written by Kyler Middleton

DevNetSecOps, DevRel, cloud security chick. I will teach you, itā€™s unavoidable. She/Her šŸ³ļøā€šŸŒˆšŸ³ļøā€šŸŒˆ, INFJ-A, support the EFF!

No responses yet