My organization has a ton of repos in GitHub. I have a subset of these repos that I want to programmatically detect. All of the repos I want start with the same string. The code below correctly finds them, but it takes about a minute to do it because of all of the repos present. Is there a faster way to do this?
def FindMyRepos():
global ACCESS_TOKEN, ORGANIZATION, PREFIX
repos = []
# Log into GitHub
gh = Github(ACCESS_TOKEN)
if not gh: return 1
# Connect to organization
org = gh.get_organization(ORGANIZATION)
if not org: return 2
# Look for repos that start with PREFIX
for r in org.get_repos():
if r.name.startswith(PREFIX):
repos.append(r.name)