Commit 2c622dc2 authored by Piotr Skorupa's avatar Piotr Skorupa

Skip PI warning for growth experiment MRs and refactor

parent a5f58316
...@@ -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?
......
...@@ -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 [] if !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