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 <anas.nashif@intel.com>
diff --git a/scripts/set_assignees.py b/scripts/set_assignees.py
index 9a29944..f9fa176 100755
--- a/scripts/set_assignees.py
+++ b/scripts/set_assignees.py
@@ -123,19 +123,29 @@
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)")