Last active
September 6, 2023 22:26
-
-
Save davidlj95/bbe8659c2239b7fdf950914c5ac2a41c to your computer and use it in GitHub Desktop.
GitHub repositories with GitHub Pages enabled
This file contains 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/sh | |
repos=$(gh repo list --limit 100 --json nameWithOwner | jq -r '.[].nameWithOwner') | |
count=0 | |
echo "{" | |
for repo in $repos; do | |
has_pages="$(gh api repos/"$repo" --jq '.has_pages')" | |
echo " \"$repo\": $has_pages," | |
if [ "$has_pages" = "true" ]; then | |
: $((count+=1)) | |
fi | |
done | |
echo "}" | |
>&2 echo "Repos with pages enabled: $count" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lists all repositories in your GitHub account that have GitHub Pages enabled. In an almost JSON style. Almost: the last element will have a comma cause got lazy to see how to avoid that last one.
Requires GitHub CLI (
gh
) to be properly configured.