Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ceb0636c
Commit
ceb0636c
authored
May 29, 2019
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use roulette for single codebase roulette
parent
c90ba127
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
danger/single_codebase/Dangerfile
danger/single_codebase/Dangerfile
+18
-11
lib/gitlab/danger/teammate.rb
lib/gitlab/danger/teammate.rb
+1
-1
No files found.
danger/single_codebase/Dangerfile
View file @
ceb0636c
def
new_teammates
(
usernames
)
usernames
.
map
{
|
u
|
::
Gitlab
::
Danger
::
Teammate
.
new
(
'username'
=>
u
)
}
end
def
mention_single_codebase_approvers
frontend_maintainers
=
%w(@filipa @iamphill)
backend_maintainers
=
%w(@rspeicher @rymai @yorickpeterse @godfat)
canonical_branch_name
=
roulette
.
canonical_branch_name
(
gitlab
.
mr_json
[
'source_branch'
])
random
=
roulette
.
new_random
(
canonical_branch_name
)
frontend_maintainers
=
new_teammates
(
%w[filipa iamphill]
)
backend_maintainers
=
new_teammates
(
%w[rspeicher rymai yorickpeterse godfat]
)
rows
=
[]
users
=
[]
if
gitlab
.
mr_labels
.
include?
(
'frontend'
)
frontend_maintainer
=
frontend_maintainers
.
sample
frontend_maintainer
=
roulette
.
spin_for_person
(
frontend_maintainers
,
random:
random
)
rows
<<
"| ~frontend | `
#{
frontend_maintainer
}
`"
users
<<
frontend_maintainer
rows
<<
"| ~frontend |
#{
frontend_maintainer
.
markdown_name
}
"
end
if
gitlab
.
mr_labels
.
include?
(
'backend'
)
backend_maintainer
=
backend_maintainers
.
sample
backend_maintainer
=
roulette
.
spin_for_person
(
backend_maintainers
,
random:
random
)
rows
<<
"| ~backend | `
#{
backend_maintainer
}
`"
users
<<
backend_maintainer
rows
<<
"| ~backend |
#{
backend_maintainer
.
markdown_name
}
"
end
if
rows
.
empty?
backup_maintainer
=
backend_maintainers
.
sample
rows
<<
"| ~frontend / ~backend | `
#{
backup_maintainer
}
`"
users
<<
backup_maintainer
rows
<<
"| ~frontend / ~backend |
#{
backup_maintainer
.
markdown_name
}
"
end
markdown
(
<<~
MARKDOWN
.
strip
)
...
...
lib/gitlab/danger/teammate.rb
View file @
ceb0636c
...
...
@@ -6,8 +6,8 @@ module Gitlab
attr_reader
:name
,
:username
,
:projects
def
initialize
(
options
=
{})
@name
=
options
[
'name'
]
@username
=
options
[
'username'
]
@name
=
options
[
'name'
]
||
@username
@projects
=
options
[
'projects'
]
end
...
...
Write
Preview
Markdown
is supported
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