summaryrefslogtreecommitdiff
path: root/danger/roulette/Dangerfile
diff options
context:
space:
mode:
Diffstat (limited to 'danger/roulette/Dangerfile')
-rw-r--r--danger/roulette/Dangerfile26
1 files changed, 19 insertions, 7 deletions
diff --git a/danger/roulette/Dangerfile b/danger/roulette/Dangerfile
index b46220d7886..06d2929cd54 100644
--- a/danger/roulette/Dangerfile
+++ b/danger/roulette/Dangerfile
@@ -40,16 +40,21 @@ for them.
MARKDOWN
OPTIONAL_REVIEW_TEMPLATE = '%{role} review is optional for %{category}'
-NOT_AVAILABLE_TEMPLATE = 'No %{role} available'
+NOT_AVAILABLE_TEMPLATES = {
+ default: 'No %{role} available',
+ product_intelligence: "No engineer is available for automated assignment, please reach out to `#g_product_intelligence` slack channel or mention `@gitlab-org/growth/product-intelligence/engineers` for assistance."
+}.freeze
+
+def note_for_spins_role(spins, role, category)
+ template = NOT_AVAILABLE_TEMPLATES[category] || NOT_AVAILABLE_TEMPLATES[:default]
-def note_for_spins_role(spins, role)
spins.each do |spin|
note = note_for_spin_role(spin, role)
return note if note
end
- NOT_AVAILABLE_TEMPLATE % { role: role }
+ template % { role: role }
end
def note_for_spin_role(spin, role)
@@ -61,8 +66,8 @@ def note_for_spin_role(spin, role)
end
def markdown_row_for_spins(category, spins_array)
- reviewer_note = note_for_spins_role(spins_array, :reviewer)
- maintainer_note = note_for_spins_role(spins_array, :maintainer)
+ maintainer_note = note_for_spins_role(spins_array, :maintainer, category)
+ reviewer_note = note_for_spins_role(spins_array, :reviewer, category)
"| #{helper.label_for_category(category)} | #{reviewer_note} | #{maintainer_note} |"
end
@@ -73,10 +78,17 @@ changes = project_helper.changes_by_category
changes.delete(:none)
# To reinstate roulette for documentation, remove this line.
changes.delete(:docs)
-categories = changes.keys - [:unknown]
+# No special review for changelog needed and changelog was never a label.
+changes.delete(:changelog)
+# No special review for feature flags needed.
+changes.delete(:feature_flag)
+categories = Set.new(changes.keys - [:unknown])
# Ensure to spin for database reviewer/maintainer when ~database is applied (e.g. to review SQL queries)
-categories << :database if helper.mr_labels.include?('database') && !categories.include?(:database)
+categories << :database if helper.mr_labels.include?('database')
+
+# Ensure to spin for Product Intelligence reviewer when ~"product intelligence::review pending" is applied
+categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
if changes.any?
project = project_helper.project_name