Skip to content

Commit c8dbae6

Browse files
committed
Add handling in case repo entry is missing in secondary file
1 parent 22ca149 commit c8dbae6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

_visualize/scripts/gather_repo_metadata.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@
2929

3030
# gather any repo topics
3131
if repoObj["repositoryTopics"]["totalCount"] > 0:
32-
topicRepo = topicsCollector.data["data"][repo]
3332
topics = []
34-
for topicObj in topicRepo["repositoryTopics"]["nodes"]:
35-
topics.append(topicObj["topic"]["name"])
33+
try:
34+
topicRepo = topicsCollector.data["data"][repo]
35+
for topicObj in topicRepo["repositoryTopics"]["nodes"]:
36+
topics.append(topicObj["topic"]["name"])
37+
except KeyError:
38+
print(
39+
"Warning: Repo '%s' not found in '%s'"
40+
% (repo, topicsDatafile.split("/")[-1])
41+
)
3642
repoData["topics"] = topics
3743
else:
3844
repoData["topics"] = None

0 commit comments

Comments
 (0)