Account for issue types in top-ranking issues script (#33118)
Release Notes: - N/A
This commit is contained in:
parent
7812985d3c
commit
9597c73f2b
2 changed files with 22 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,6 +12,7 @@
|
||||||
.flatpak-builder
|
.flatpak-builder
|
||||||
.idea
|
.idea
|
||||||
.netrc
|
.netrc
|
||||||
|
*.pyc
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
.swiftpm
|
.swiftpm
|
||||||
.swiftpm/config/registries.json
|
.swiftpm/config/registries.json
|
||||||
|
|
|
@ -126,23 +126,30 @@ def get_label_to_issues(
|
||||||
|
|
||||||
common_filter_string = " ".join(common_filters)
|
common_filter_string = " ".join(common_filters)
|
||||||
|
|
||||||
section_queries = {
|
# Because PyGithub doesn't seem to support logical operators `AND` and `OR`
|
||||||
"bug": "label:bug,type:Bug",
|
# that GitHub issue queries can use, we use lists as values, rather than
|
||||||
"crash": "label:crash,type:Crash",
|
# using `(label:bug OR type:Bug)`. This is not as efficient, as we might
|
||||||
"feature": "label:feature",
|
# query the same issue multiple times. Issues that are potentially queried
|
||||||
"meta": "type:Meta",
|
# multiple times are deduplicated in the `label_to_issues` dictionary. If
|
||||||
"unlabeled": "no:label no:type",
|
# 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)
|
label_to_issues: defaultdict[str, list[Issue]] = defaultdict(list)
|
||||||
|
|
||||||
for section, section_query in section_queries.items():
|
for section, section_queries in section_queries.items():
|
||||||
label_query: str = f"{common_filter_string} {section_query}"
|
for section_query in section_queries:
|
||||||
|
query: str = f"{common_filter_string} {section_query}"
|
||||||
issues = github.search_issues(label_query)
|
issues = github.search_issues(query)
|
||||||
|
|
||||||
if issues.totalCount > 0:
|
if issues.totalCount > 0:
|
||||||
for issue in issues[0:ISSUES_PER_LABEL]:
|
for issue in issues:
|
||||||
label_to_issues[section].append(issue)
|
label_to_issues[section].append(issue)
|
||||||
|
|
||||||
return label_to_issues
|
return label_to_issues
|
||||||
|
@ -164,7 +171,7 @@ def get_label_to_issue_data(
|
||||||
)
|
)
|
||||||
|
|
||||||
if 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
|
return label_to_issue_data
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue