-
-
Save KyMidd/cc1a03a98ee44990cb9fb1ece89ade4f to your computer and use it in GitHub Desktop.
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
| # Find count of all repos in org and store as var | |
| def get_repo_count(): | |
| # Get API token wallet | |
| hold_until_rate_limit_success() | |
| # Find how many repos exist in the Org | |
| org_info = requests.get( | |
| url="https://api.github.com/orgs/"+GITHUB_ORG, | |
| headers=headers | |
| ) | |
| # Check response code, and if not 200, exit | |
| if org_info.status_code != 200: | |
| print("Error fetching org info") | |
| exit(1) | |
| # Store info | |
| PRIVATE_REPO_COUNT=org_info.json()['owned_private_repos'] | |
| PUBLIC_REPO_COUNT=org_info.json()['public_repos'] | |
| TOTAL_REPO_COUNT=PRIVATE_REPO_COUNT+PUBLIC_REPO_COUNT | |
| # Build dict of info and return | |
| d = dict(); | |
| d['PRIVATE_REPO_COUNT'] = PRIVATE_REPO_COUNT | |
| d['PUBLIC_REPO_COUNT'] = PUBLIC_REPO_COUNT | |
| d['TOTAL_REPO_COUNT'] = TOTAL_REPO_COUNT | |
| return d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment