Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
assignbot
Commits
165c0257a56e
Commit
e3346db0
authored
Sep 28, 2020
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
assignbot/__main__.py
View file @
165c0257
...
...
@@ -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
):
m
r_with_to_review_tag
=
self
.
cnx
.
mergerequests
.
list
(
m
erge_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
(
labels
=
"None"
,
state
=
"opened"
,
wip
=
"no"
,
scope
=
"all"
,
assignee_id
=
"None"
,
as_list
=
False
,
all
=
True
,
merge_requests
.
extend
(
self
.
cnx
.
mergerequests
.
list
(
labels
=
"None"
,
state
=
"opened"
,
wip
=
"no"
,
scope
=
"all"
,
assignee_id
=
"None"
,
all
=
True
,
)
)
for
merge_request
in
chain
(
mr_with_to_review_tag
,
mr_with_no_tags
):
shuffle
(
merge_requests
)
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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment