Created
November 16, 2025 03:55
-
-
Save goosetav/cc864686fa61b0b1ad9c16e18e3b714a to your computer and use it in GitHub Desktop.
Count non-archived repos (public + private) for organizations under GitHub Enterprise
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 | |
| echo "Organizations under sgnlai enterprise (non-archived only):" | |
| echo "" | |
| total_all=0 | |
| total_public=0 | |
| total_private=0 | |
| for org in sgnl-actions SGNL-ai SGNL-SE sgnl-training wholesalechips; do | |
| # Get all non-archived repos and count public vs private | |
| result=$(gh api /orgs/$org/repos --paginate -q ' | |
| [.[] | select(.archived == false)] | | |
| { | |
| total: length, | |
| public: [.[] | select(.visibility == "public")] | length, | |
| private: [.[] | select(.visibility == "private")] | length | |
| } | |
| ' 2>/dev/null) | |
| all=$(echo "$result" | jq -s 'map(.total) | add // 0') | |
| pub=$(echo "$result" | jq -s 'map(.public) | add // 0') | |
| priv=$(echo "$result" | jq -s 'map(.private) | add // 0') | |
| total_all=$((total_all + all)) | |
| total_public=$((total_public + pub)) | |
| total_private=$((total_private + priv)) | |
| case $org in | |
| "sgnl-actions") name="SGNL Actions"; url="https://github.com/sgnl-actions" ;; | |
| "SGNL-ai") name="SGNL"; url="https://github.com/SGNL-ai" ;; | |
| "SGNL-SE") name="SGNL-SE"; url="https://github.com/SGNL-SE" ;; | |
| "sgnl-training") name="sgnl-training"; url="https://github.com/sgnl-training" ;; | |
| "wholesalechips") name="wholesalechips"; url="https://github.com/wholesalechips" ;; | |
| esac | |
| echo "$name - $url" | |
| echo " Total: $all repos (Public: $pub, Private: $priv)" | |
| echo "" | |
| done | |
| echo "========================================" | |
| echo "Enterprise Total: $total_all non-archived repos" | |
| echo " Public: $total_public, Private: $total_private" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment