Skip to content

Commit 1a46b7e

Browse files
committed
ci: assignees: set multiple assignees of same area
Noticing many PRs that wait too long in the queue although once of the maintainers approved with asignees set to other maintainers. This changes the current behavior of picking the first maintainer in the list and assigning to them only, instead we assign to all maintainers of the main area being changed. Who ends up driving the PR to a mergeable state is then to the maintainers and they can unassign/assign based on availability. Signed-off-by: Anas Nashif <[email protected]>
1 parent 15dc87d commit 1a46b7e

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

scripts/set_assignees.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def process_pr(gh, maintainer_file, number):
122122
log(f"Submitted by: {pr.user.login}")
123123
log(f"candidate maintainers: {_all_maintainers}")
124124

125-
maintainers = list(_all_maintainers.keys())
126-
assignee = None
125+
assignees = []
127126

128127
# we start with areas with most files changed and pick the maintainer from the first one.
129128
# if the first area is an implementation, i.e. driver or platform, we
@@ -132,26 +131,14 @@ def process_pr(gh, maintainer_file, number):
132131
if count == 0:
133132
continue
134133
if len(area.maintainers) > 0:
135-
assignee = area.maintainers[0]
134+
assignees = area.maintainers
136135

137136
if 'Platform' not in area.name:
138137
break
139138

140-
# if the submitter is the same as the maintainer, check if we have
141-
# multiple maintainers
142-
if len(maintainers) > 1 and pr.user.login == assignee:
143-
log("Submitter is same as Assignee, trying to find another assignee...")
144-
aff = list(area_counter.keys())[0]
145-
for area in all_areas:
146-
if area == aff:
147-
if len(area.maintainers) > 1:
148-
assignee = area.maintainers[1]
149-
else:
150-
log(f"This area has only one maintainer, keeping assignee as {assignee}")
151-
152-
if assignee:
153-
prop = (found_maintainers[assignee] / num_files) * 100
154-
log(f"Picked assignee: {assignee} ({prop:.2f}% ownership)")
139+
if assignees:
140+
prop = (found_maintainers[assignees[0]] / num_files) * 100
141+
log(f"Picked assignees: {assignees} ({prop:.2f}% ownership)")
155142
log("+++++++++++++++++++++++++")
156143

157144
# Set labels
@@ -217,10 +204,11 @@ def process_pr(gh, maintainer_file, number):
217204

218205
ms = []
219206
# assignees
220-
if assignee and not pr.assignee:
207+
if assignees and not pr.assignee:
221208
try:
222-
u = gh.get_user(assignee)
223-
ms.append(u)
209+
for assignee in assignees:
210+
u = gh.get_user(assignee)
211+
ms.append(u)
224212
except GithubException:
225213
log(f"Error: Unknown user")
226214

0 commit comments

Comments
 (0)