Skip to content

Commit

Permalink
ci: set_assignee: pick next area when submitter = assignee
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nashif committed Jul 10, 2024
1 parent 0cf89bb commit 913426e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/set_assignees.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down

0 comments on commit 913426e

Please sign in to comment.