Last active
December 15, 2023 17:10
-
-
Save dorneanu/d25e5eb327429095285fd6552486d064 to your computer and use it in GitHub Desktop.
Python: List all repos inside a organization using python and github3
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
# Make sure you authorize your access token to be used with SAML | |
# https://help.github.com/articles/authorizing-a-personal-access-token-for-use-with-a-saml-single-sign-on-organization/ | |
# | |
# Run: | |
# python list_all_repos.py <org> | |
import github3 | |
import os | |
GITHUB_ACCESS_TOKEN = os.environ["GITHUB_ACCESS_TOKEN"] | |
gh = github3.login(token=GITHUB_ACCESS_TOKEN) | |
org = gh.organization(os.argv[1]) | |
repos = list(org.iter_repos(type="all")) | |
for r in repos: | |
print(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment