Skip to content

Commit

Permalink
ci: assignees: set multiple assignees of same area
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
nashif committed Jun 18, 2024
1 parent 15dc87d commit 1a46b7e
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions scripts/set_assignees.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ def process_pr(gh, maintainer_file, number):
log(f"Submitted by: {pr.user.login}")
log(f"candidate maintainers: {_all_maintainers}")

maintainers = list(_all_maintainers.keys())
assignee = None
assignees = []

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

if 'Platform' not in area.name:
break

# if the submitter is the same as the maintainer, check if we have
# multiple maintainers
if len(maintainers) > 1 and pr.user.login == assignee:
log("Submitter is same as Assignee, trying to find another assignee...")
aff = list(area_counter.keys())[0]
for area in all_areas:
if area == aff:
if len(area.maintainers) > 1:
assignee = area.maintainers[1]
else:
log(f"This area has only one maintainer, keeping assignee as {assignee}")

if assignee:
prop = (found_maintainers[assignee] / num_files) * 100
log(f"Picked assignee: {assignee} ({prop:.2f}% ownership)")
if assignees:
prop = (found_maintainers[assignees[0]] / num_files) * 100
log(f"Picked assignees: {assignees} ({prop:.2f}% ownership)")
log("+++++++++++++++++++++++++")

# Set labels
Expand Down Expand Up @@ -217,10 +204,11 @@ def process_pr(gh, maintainer_file, number):

ms = []
# assignees
if assignee and not pr.assignee:
if assignees and not pr.assignee:
try:
u = gh.get_user(assignee)
ms.append(u)
for assignee in assignees:
u = gh.get_user(assignee)
ms.append(u)
except GithubException:
log(f"Error: Unknown user")

Expand Down

0 comments on commit 1a46b7e

Please sign in to comment.