Created
October 20, 2022 18:55
-
-
Save amenocal/9295daa8d7159f34c778f1d02c0e372e to your computer and use it in GitHub Desktop.
Repos with Branch Protections in an Org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gh api --paginate graphql -f organization=<orgname> -f query='query($organization: String!, $endCursor: String) { | |
| organization(login: $organization) { | |
| login | |
| repositories(first: 100, after: $endCursor) { | |
| nodes { | |
| nameWithOwner | |
| branchProtectionRules(first: 100, after: $endCursor) { | |
| totalCount | |
| nodes { | |
| repository { | |
| nameWithOwner | |
| } | |
| } | |
| } | |
| } | |
| pageInfo { | |
| hasNextPage | |
| endCursor | |
| } | |
| } | |
| } | |
| }' --jq '.data.organization.repositories.nodes[] | "\(.nameWithOwner),\(.branchProtectionRules.totalCount)"' > org-branch-protections.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment