Account for issue types in top-ranking issues script (#33118)

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-06-20 14:19:29 -04:00 committed by GitHub
parent 7812985d3c
commit 9597c73f2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 14 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
.flatpak-builder
.idea
.netrc
*.pyc
.pytest_cache
.swiftpm
.swiftpm/config/registries.json

View file

@ -126,24 +126,31 @@ def get_label_to_issues(
common_filter_string = " ".join(common_filters)
section_queries = {
"bug": "label:bug,type:Bug",
"crash": "label:crash,type:Crash",
"feature": "label:feature",
"meta": "type:Meta",
"unlabeled": "no:label no:type",
# Because PyGithub doesn't seem to support logical operators `AND` and `OR`
# that GitHub issue queries can use, we use lists as values, rather than
# using `(label:bug OR type:Bug)`. This is not as efficient, as we might
# query the same issue multiple times. Issues that are potentially queried
# multiple times are deduplicated in the `label_to_issues` dictionary. If
# PyGithub ever supports logical operators, we should definitely make the
# switch.
section_queries: dict[str, list[str]] = {
"bug": ["label:bug", "type:Bug"],
"crash": ["label:crash", "type:Crash"],
"feature": ["label:feature", "type:Feature"],
"meta": ["type:Meta"],
"unlabeled": ["no:label no:type"],
}
label_to_issues: defaultdict[str, list[Issue]] = defaultdict(list)
for section, section_query in section_queries.items():
label_query: str = f"{common_filter_string} {section_query}"
for section, section_queries in section_queries.items():
for section_query in section_queries:
query: str = f"{common_filter_string} {section_query}"
issues = github.search_issues(query)
issues = github.search_issues(label_query)
if issues.totalCount > 0:
for issue in issues[0:ISSUES_PER_LABEL]:
label_to_issues[section].append(issue)
if issues.totalCount > 0:
for issue in issues:
label_to_issues[section].append(issue)
return label_to_issues
@ -164,7 +171,7 @@ def get_label_to_issue_data(
)
if issue_data:
label_to_issue_data[label] = issue_data
label_to_issue_data[label] = issue_data[0:ISSUES_PER_LABEL]
return label_to_issue_data