Merge pull request #260 from coreos-inc/githubfix

GitHub api now returns ALL the visible repositories for user
This commit is contained in:
Jimmy Zelinskie 2015-07-22 13:53:58 -04:00
commit 2c29dc048d

View file

@ -704,32 +704,25 @@ class GithubBuildTrigger(BuildTriggerHandler):
except GithubException:
raise RepositoryReadException('Unable to list user repositories')
personal = {
'personal': True,
'repos': [repo.full_name for repo in repos],
'info': {
'name': usr.login,
'avatar_url': usr.avatar_url,
}
}
namespaces = {}
repos_by_org = [personal]
for org in usr.get_orgs():
repo_list = []
for repo in org.get_repos(type='member'):
repo_list.append(repo.full_name)
repos_by_org.append({
'personal': False,
'repos': repo_list,
'info': {
'name': org.name or org.login,
'avatar_url': org.avatar_url
for repository in repos:
namespace = repository.owner.login
if not namespace in namespaces:
namespaces[namespace] = {
'personal': namespace == usr.login,
'repos': [],
'info': {
'name': namespace,
'avatar_url': repository.owner.avatar_url
}
}
})
return repos_by_org
namespaces[namespace]['repos'].append(repository.full_name)
entries = list(namespaces.values())
entries.sort(key=lambda e: e['info']['name'])
return entries
def list_build_subdirs(self):
config = self.config