Commit ad5f462e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch...

Merge branch '344929-danger-fails-to-run-review-roulette-on-product-intelligence-changes' into 'master'

Fix Danger not adding a warning when there are no PI labels to add

See merge request gitlab-org/gitlab!75949
parents e13eeea0 5aabda94
...@@ -15,8 +15,8 @@ MSG ...@@ -15,8 +15,8 @@ MSG
product_intelligence_paths_to_review = helper.changes_by_category[:product_intelligence] product_intelligence_paths_to_review = helper.changes_by_category[:product_intelligence]
labels_to_add = product_intelligence.missing_labels labels_to_add = product_intelligence.missing_labels
return if product_intelligence_paths_to_review.empty? || labels_to_add.empty? return if product_intelligence_paths_to_review.empty?
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) unless product_intelligence.has_approved_label?
project_helper.labels_to_add.concat(labels_to_add) project_helper.labels_to_add.concat(labels_to_add) unless labels_to_add.empty?
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
module Tooling module Tooling
module Danger module Danger
module ProductIntelligence module ProductIntelligence
APPROVED_LABEL = 'product intelligence::approved'
REVIEW_LABEL = 'product intelligence::review pending'
WORKFLOW_LABELS = [ WORKFLOW_LABELS = [
'product intelligence::approved', APPROVED_LABEL,
'product intelligence::review pending' REVIEW_LABEL
].freeze ].freeze
def missing_labels def missing_labels
...@@ -14,11 +17,15 @@ module Tooling ...@@ -14,11 +17,15 @@ module Tooling
labels = [] labels = []
labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence') labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence')
labels << 'product intelligence::review pending' unless has_workflow_labels? labels << REVIEW_LABEL unless has_workflow_labels?
labels labels
end end
def has_approved_label?
helper.mr_labels.include?(APPROVED_LABEL)
end
private private
def has_workflow_labels? def has_workflow_labels?
......
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