diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-02 15:09:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-02 15:09:21 +0300 |
commit | d2eb61914a7ad4667136815d2120a619b6045b58 (patch) | |
tree | e1ccb573a1004f8e08230d778d75fec6a4feaa6e /danger/roulette | |
parent | 9cd5033338348e41c06b09211161a32ed9a8b18a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger/roulette')
-rw-r--r-- | danger/roulette/Dangerfile | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile index ba2d50657e0..527cdf58391 100644 --- a/danger/roulette/Dangerfile +++ b/danger/roulette/Dangerfile @@ -60,29 +60,22 @@ NOT_AVAILABLE_TEMPLATES = { integrations_fe: group_not_available_template('#g_ecosystem_integrations', '@gitlab-org/ecosystem-stage/integrations') }.freeze -def note_for_spins_role(spins, role, category) +def note_for_spin_role(spin, role, category) template = NOT_AVAILABLE_TEMPLATES[category] || NOT_AVAILABLE_TEMPLATES[:default] - spins.each do |spin| - note = note_for_spin_role(spin, role) + note = + if spin.optional_role == role + OPTIONAL_REVIEW_TEMPLATE % { role: role.capitalize, category: helper.label_for_category(spin.category) } + else + spin.public_send(role)&.markdown_name(author: roulette.team_mr_author) # rubocop:disable GitlabSecurity/PublicSend + end - return note if note - end - - template % { role: role } -end - -def note_for_spin_role(spin, role) - if spin.optional_role == role - return OPTIONAL_REVIEW_TEMPLATE % { role: role.capitalize, category: helper.label_for_category(spin.category) } - end - - spin.public_send(role)&.markdown_name(author: roulette.team_mr_author) # rubocop:disable GitlabSecurity/PublicSend + note || template % { role: role } end -def markdown_row_for_spins(category, spins_array) - maintainer_note = note_for_spins_role(spins_array, :maintainer, category) - reviewer_note = note_for_spins_role(spins_array, :reviewer, category) +def markdown_row_for_spin(category, spin) + maintainer_note = note_for_spin_role(spin, :maintainer, category) + reviewer_note = note_for_spin_role(spin, :reviewer, category) "| #{helper.label_for_category(category)} | #{reviewer_note} | #{maintainer_note} |" end @@ -115,7 +108,7 @@ if changes.any? random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false) rows = random_roulette_spins.map do |spin| - markdown_row_for_spins(spin.category, [spin]) + markdown_row_for_spin(spin.category, spin) end markdown(REVIEW_ROULETTE_SECTION) |