Last active
February 28, 2024 14:43
-
-
Save rgs/0d2c0c122b646c329f7cc32828d6f566 to your computer and use it in GitHub Desktop.
Find all repositories without CODEOWNERS
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
#!/bin/bash | |
# This will output a CSV of all non-archived repositories in the | |
# specified organisation, and whether the CODEOWNERS file is here | |
# or not found. Also exclude forked repositories. A suitable token | |
# must be in the environment variable $GH_TOKEN. | |
ORGA=rgs | |
for repo in $( gh repo list $ORGA --json isArchived,isFork,name --limit 500 \ | |
--jq '.[] | select(.isArchived == false) | select(.isFork == false) | .name' \ | |
| sort ) | |
do | |
echo -n "$repo," | |
gh api \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authentication: Bearer $GH_TOKEN" \ | |
/repos/$ORGA/$repo/contents/CODEOWNERS 2>/dev/null \ | |
| jq -S '.name // .message' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment