Commit e3346db0 authored by Simon Chabot's avatar Simon Chabot
Browse files

feat: assign merge request in a randomized order

so that older merge request also get a chance to be reviewed
parent 21cdfc52da09
Pipeline #15617 passed with stage
in 27 seconds
......@@ -21,8 +21,7 @@
import os
from argparse import ArgumentParser
from itertools import chain
from random import choice
from random import choice, shuffle
from datetime import datetime, timedelta
import yaml
......@@ -137,27 +136,29 @@ class ReviewAssigner:
print(f"{user.name} has been assigned to {merge_request.title}")
def all_reviews_to_do(self):
mr_with_to_review_tag = self.cnx.mergerequests.list(
merge_requests = self.cnx.mergerequests.list(
labels=TO_REVIEW_LABEL,
state="opened",
wip="no",
scope="all",
assignee_id="None",
as_list=False,
all=True,
)
mr_with_no_tags = self.cnx.mergerequests.list(
merge_requests.extend(
self.cnx.mergerequests.list(
labels="None",
state="opened",
wip="no",
scope="all",
assignee_id="None",
as_list=False,
all=True,
)
)
shuffle(merge_requests)
for merge_request in chain(mr_with_to_review_tag, mr_with_no_tags):
for merge_request in merge_requests:
project = self.cnx.projects.get(merge_request.project_id)
if CLIENT_PROJECT_TAG in project.tag_list:
# it's a client project. Let's assume that someone will take
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment