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:
|
except GithubException:
|
||||||
raise RepositoryReadException('Unable to list user repositories')
|
raise RepositoryReadException('Unable to list user repositories')
|
||||||
|
|
||||||
personal = {
|
namespaces = {}
|
||||||
'personal': True,
|
|
||||||
'repos': [repo.full_name for repo in repos],
|
|
||||||
'info': {
|
|
||||||
'name': usr.login,
|
|
||||||
'avatar_url': usr.avatar_url,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repos_by_org = [personal]
|
for repository in repos:
|
||||||
|
namespace = repository.owner.login
|
||||||
for org in usr.get_orgs():
|
if not namespace in namespaces:
|
||||||
repo_list = []
|
namespaces[namespace] = {
|
||||||
for repo in org.get_repos(type='member'):
|
'personal': namespace == usr.login,
|
||||||
repo_list.append(repo.full_name)
|
'repos': [],
|
||||||
|
'info': {
|
||||||
repos_by_org.append({
|
'name': namespace,
|
||||||
'personal': False,
|
'avatar_url': repository.owner.avatar_url
|
||||||
'repos': repo_list,
|
}
|
||||||
'info': {
|
|
||||||
'name': org.name or org.login,
|
|
||||||
'avatar_url': org.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):
|
def list_build_subdirs(self):
|
||||||
config = self.config
|
config = self.config
|
||||||
|
|
Reference in a new issue