Commit 92b65146 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch...

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

Fix wrong conditional skipping Product Intelligence review roulette

See merge request gitlab-org/gitlab!76781
parents 202fd181 0744e1a5
...@@ -15,7 +15,7 @@ MSG ...@@ -15,7 +15,7 @@ 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? return if product_intelligence_paths_to_review.empty? || product_intelligence.skip_review?
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) unless product_intelligence.has_approved_label? warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(product_intelligence_paths_to_review)) unless product_intelligence.has_approved_label?
......
...@@ -111,7 +111,7 @@ categories << :ux if (["UX", "Community contribution"] - helper.mr_labels).empty ...@@ -111,7 +111,7 @@ categories << :ux if (["UX", "Community contribution"] - helper.mr_labels).empty
categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending") categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
# Skip Product intelligence reviews for growth experiment MRs # Skip Product intelligence reviews for growth experiment MRs
categories.delete(:product_intelligence) unless helper.mr_labels.include?("growth experiment") categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment")
if changes.any? if changes.any?
random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false) random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false)
......
...@@ -65,13 +65,25 @@ RSpec.describe Tooling::Danger::ProductIntelligence do ...@@ -65,13 +65,25 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
it { is_expected.to be_empty } it { is_expected.to be_empty }
end end
end end
end
describe '#skip_review' do
subject { product_intelligence.skip_review? }
context 'with growth experiment label' do context 'with growth experiment label' do
before do before do
allow(fake_helper).to receive(:mr_has_labels?).with('growth experiment').and_return(true) allow(fake_helper).to receive(:mr_has_labels?).with('growth experiment').and_return(true)
end end
it { is_expected.to be_empty } it { is_expected.to be true }
end
context 'without growth experiment label' do
before do
allow(fake_helper).to receive(:mr_has_labels?).with('growth experiment').and_return(false)
end
it { is_expected.to be false }
end end
end end
end end
...@@ -13,7 +13,7 @@ module Tooling ...@@ -13,7 +13,7 @@ module Tooling
].freeze ].freeze
def missing_labels def missing_labels
return [] if !helper.ci? || helper.mr_has_labels?('growth experiment') return [] unless helper.ci?
labels = [] labels = []
labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence') labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence')
...@@ -26,6 +26,10 @@ module Tooling ...@@ -26,6 +26,10 @@ module Tooling
helper.mr_labels.include?(APPROVED_LABEL) helper.mr_labels.include?(APPROVED_LABEL)
end end
def skip_review?
helper.mr_has_labels?('growth experiment')
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