GitHub api now returns ALL the visible repositories for user
Change the code to simply filter the single list returned, rather than reloading the org repos again
This commit is contained in:
parent
5d86fa80e7
commit
69ca34161c
1 changed files with 16 additions and 23 deletions
|
@ -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
|
||||
|
|
Reference in a new issue