Skip to content

Commit 247355e

Browse files
committed
simplify assignee by using filtered PR list
1 parent 40e5c04 commit 247355e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

.github/update_release_pr.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,12 @@ def get_prs(pull_request_items: list[dict], label: str = "", state: str = "all")
107107

108108
return pr_list
109109

110-
def get_prs_assignees(pull_request_items: list[dict], label: str = "", state: str = "all") -> list[str]:
110+
def get_prs_assignees(pull_request_items: list[dict]) -> list[str]:
111111
"""
112-
Returns a list of pull request assignees after applying the label and state filters, excludes jjw24.
112+
Returns a list of pull request assignees, excludes jjw24.
113113
114114
Args:
115-
pull_request_items (list[dict]): List of PR items.
116-
label (str): The label name. Filter is not applied when empty string.
117-
state (str): State of PR, e.g. open, closed, all
115+
pull_request_items (list[dict]): List of PR items to get the assignees from.
118116
119117
Returns:
120118
list: A list of strs, where each string is an assignee name. List is not distinct, so can contain
@@ -123,10 +121,9 @@ def get_prs_assignees(pull_request_items: list[dict], label: str = "", state: st
123121
"""
124122
assignee_list = []
125123
for pr in pull_request_items:
126-
if state in [pr["state"], "all"] and (not label or [item for item in pr["labels"] if item["name"] == label]):
127-
[assignee_list.append(assignee["login"]) for assignee in pr["assignees"] if assignee["login"] != "jjw24" ]
124+
[assignee_list.append(assignee["login"]) for assignee in pr["assignees"] if assignee["login"] != "jjw24" ]
128125

129-
print(f"Found {len(assignee_list)} assignees with {label if label else 'no filter on'} label and state as {state}")
126+
print(f"Found {len(assignee_list)} assignees")
130127

131128
return assignee_list
132129

@@ -230,7 +227,7 @@ def update_pull_request_description(token: str, owner: str, repo: str, pr_number
230227
description_content += f"## Features\n{get_pr_descriptions(enhancement_prs)}" if enhancement_prs else ""
231228
description_content += f"## Bug fixes\n{get_pr_descriptions(bug_fix_prs)}" if bug_fix_prs else ""
232229

233-
assignees = list(set(get_prs_assignees(pull_requests, "enhancement", "closed") + get_prs_assignees(pull_requests, "bug", "closed")))
230+
assignees = list(set(get_prs_assignees(enhancement_prs) + get_prs_assignees(bug_fix_prs)))
234231
assignees.sort(key=str.lower)
235232

236233
description_content += f"### Authors:\n{', '.join(assignees)}"

0 commit comments

Comments
 (0)