From 913426e585e9dc72b9bc3eb04f44be192ccbfd6a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 25 Jun 2024 21:56:57 -0400 Subject: [PATCH] ci: set_assignee: pick next area when submitter = assignee Address the cases where submitter is also the maintainer of the code changed and other areas are being changed. In this case, assign to the next area maintainers instead of assigning to submitter. Example: maintainer of component A introduced significant changes to area A but also makes changes to other areas B and C. Right now maintainers of B and C are added as reviewers. This change will assign to the next area after A, i.e. B in cases where the submitter is also the maintainer of area A. Signed-off-by: Anas Nashif --- scripts/set_assignees.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py index 9a2994411cf529..f9fa1769a8d7bd 100755 --- a/scripts/set_assignees.py +++ b/scripts/set_assignees.py @@ -123,19 +123,29 @@ def process_pr(gh, maintainer_file, number): log(f"candidate maintainers: {_all_maintainers}") assignees = [] + tmp_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 - # continue searching for any other areas + # continue searching for any other areas involved for area, count in area_counter.items(): if count == 0: continue if len(area.maintainers) > 0: - assignees = area.maintainers + tmp_assignees = area.maintainers + if pr.user.login in area.maintainers: + # submitter = assignee, try to pick next area and + # assign someone else other than the submitter + continue + else: + assignees = area.maintainers if 'Platform' not in area.name: break + if tmp_assignees and not assignees: + assignees = tmp_assignees + if assignees: prop = (found_maintainers[assignees[0]] / num_files) * 100 log(f"Picked assignees: {assignees} ({prop:.2f}% ownership)")