Listing the status of your branch protection in GitHub

Featured image for sharing metadata for article

I've recently been doing an audit of my branches across the repos I have on GitHub, and needed a way to list all the protection in place across various repos.

To make it easier, I've created a Go tool, which can be installed like:

go install gitlab.com/tanna.dev/github-branch-protection@HEAD

Then, create a file i.e. repos.txt i.e.:

jamietanna/jamietanna
jamietanna/pages-testing

Then run:

github-branch-protection repos.txt

And it'll output a Tab Separated Value (TSV) formatted output, such as:

OrganisationRepoBranchBranch exists?Branch protected?Any required status checks?Required status checksStrict status checks?Push restrictions?Admins included?Force pushes allowed?Deletions allowed?PR review required?CODEOWNERS required to review?Review bypasses allowed for?
jamietannajamietannamaintruefalse
jamietannajamietannamasterfalse
jamietannapages-testingmaintruetruefalsefalsetruefalsefalsetruetrue
jamietannapages-testingmasterfalse

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #github.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.