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>
This commit is contained in:
Anas Nashif 2024-06-25 21:56:57 -04:00
parent 0cf89bb8b4
commit 913426e585
1 changed files with 12 additions and 2 deletions

View File

@ -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)")