Skip to content

Instantly share code, notes, and snippets.

@boxrick
Created September 13, 2018 00:24
Show Gist options
  • Save boxrick/a746f310ff06d7462aee27d07362088d to your computer and use it in GitHub Desktop.
Save boxrick/a746f310ff06d7462aee27d07362088d to your computer and use it in GitHub Desktop.
But of python taken and modified to fix, clones all repos from an org, matching on name then prints the list
#!/usr/bin/env python
import pygithub3
import re
gh = None
def gather_clone_urls(organization, no_forks=True):
all_repos = gh.repos.list_by_org(organization,type='all').all()
for repo in all_repos:
# Don't print the urls for repos that are forks.
if no_forks and repo.fork:
continue
yield repo.clone_url
if __name__ == '__main__':
gh = pygithub3.Github(token="TOKEN")
clone_urls = gather_clone_urls("ORG")
for url in clone_urls:
if re.search('MATCH', url):
print url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment