scripts: set_assignee: don't skip assignment on too many labels

The set assignee script currently exits if there's too many labels
associated with a PR. Change that to just skip the label assignment, but
continue on to assign a maintainer based on the most relevant area.

Tested with:

  ./scripts/set_assignees.py -v --dry-run -P 52716

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-01-26 17:03:13 +00:00 committed by Anas Nashif
parent ac5d45a080
commit 16d723ee1b

View file

@ -80,9 +80,6 @@ def process_pr(gh, maintainer_file, number):
ac = dict(sorted(area_counter.items(), key=lambda item: item[1], reverse=True)) ac = dict(sorted(area_counter.items(), key=lambda item: item[1], reverse=True))
log(f"Area matches: {ac}") log(f"Area matches: {ac}")
log(f"labels: {labels}") log(f"labels: {labels}")
if len(labels) > 10:
log(f"Too many labels to be applied")
return
# Create a list of collaborators ordered by the area match # Create a list of collaborators ordered by the area match
collab = list() collab = list()
@ -143,11 +140,14 @@ def process_pr(gh, maintainer_file, number):
log("+++++++++++++++++++++++++") log("+++++++++++++++++++++++++")
# Set labels # Set labels
if labels and len(labels) < 10: if labels:
for l in labels: if len(labels) < 10:
log(f"adding label {l}...") for l in labels:
if not args.dry_run: log(f"adding label {l}...")
pr.add_to_labels(l) if not args.dry_run:
pr.add_to_labels(l)
else:
log(f"Too many labels to be applied")
if collab: if collab:
reviewers = [] reviewers = []