Skip to content

Commit

Permalink
add case when owner doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-codecov committed Mar 7, 2024
1 parent 7b231e9 commit bf3f7f4
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions shared/torngit/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -1669,19 +1669,25 @@ async def get_languages_graphql(
body=query,
token=token,
)
repositories = res["data"]["repositoryOwner"]["repositories"]
hasNextPage = repositories["pageInfo"]["hasNextPage"]
endCursor = repositories["pageInfo"]["endCursor"]

for repo in repositories["nodes"]:
languages = repo["languages"]["edges"]
res_languages = []
for language in languages:
res_languages.append(language["node"]["name"])

all_repositories.append(
RepoWithLanguages(name=repo["name"], languages=res_languages)
)
repoOwner = res["data"]["repositoryOwner"]
if not repoOwner:
hasNextPage = False
else:
repositories = repoOwner["repositories"]
hasNextPage = repositories["pageInfo"]["hasNextPage"]
endCursor = repositories["pageInfo"]["endCursor"]

for repo in repositories["nodes"]:
languages = repo["languages"]["edges"]
res_languages = []
for language in languages:
res_languages.append(language["node"]["name"])

all_repositories.append(
RepoWithLanguages(
name=repo["name"], languages=res_languages
)
)

return all_repositories

Expand Down

0 comments on commit bf3f7f4

Please sign in to comment.