Skip to content

Instantly share code, notes, and snippets.

@gp42
Last active May 30, 2023 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gp42/5e7364bcc74fe8402e9dc33074eb53d3 to your computer and use it in GitHub Desktop.
Save gp42/5e7364bcc74fe8402e9dc33074eb53d3 to your computer and use it in GitHub Desktop.
List all repositories in a GitHub Organization
# List all repositories in GitHub Organization
#
# GIT_ORG - Organization name
# GIT_TOKEN - GitHub access token
#
import os
# pip install pygithub
from github import Github
org = os.environ['GIT_ORG']
git_token = os.environ['GIT_TOKEN']
g = Github(git_token)
for repo in g.get_organization(org).get_repos(sort='full_name'):
print(f'{repo.name},{repo.archived}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment