Commit 4168787c authored by alinamihaila's avatar alinamihaila Committed by Rémy Coutable

Skip Product Intelligence review for growth experiments MRs

parent e06b922e
...@@ -10,14 +10,13 @@ Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/deve ...@@ -10,14 +10,13 @@ Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/deve
MSG MSG
# exit if not matching files # exit if not matching files or if no product intelligence labels
matching_changed_files = product_intelligence.matching_changed_files matching_changed_files = product_intelligence.matching_changed_files
return unless matching_changed_files.any? labels = product_intelligence.missing_labels
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files)) return if matching_changed_files.empty? || labels.empty?
labels = product_intelligence.missing_labels warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
return unless labels.any?
gitlab.api.update_merge_request(gitlab.mr_json['project_id'], gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
gitlab.mr_json['iid'], gitlab.mr_json['iid'],
......
...@@ -98,6 +98,7 @@ categories << :database if helper.mr_labels.include?('database') ...@@ -98,6 +98,7 @@ categories << :database if helper.mr_labels.include?('database')
# Ensure to spin for Product Intelligence reviewer when ~"product intelligence::review pending" is applied # 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") categories << :product_intelligence if helper.mr_labels.include?("product intelligence::review pending")
categories.delete(:product_intelligence) unless helper.mr_labels.include?("product intelligence")
if changes.any? if changes.any?
project = project_helper.project_name project = project_helper.project_name
......
...@@ -59,6 +59,14 @@ RSpec.describe Tooling::Danger::ProductIntelligence do ...@@ -59,6 +59,14 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
it { is_expected.to be_empty } it { is_expected.to be_empty }
end end
context 'with growth experiment label' do
before do
allow(fake_helper).to receive(:mr_has_labels?).with('growth experiment').and_return(true)
end
it { is_expected.to be_empty }
end
end end
describe '#matching_changed_files' do describe '#matching_changed_files' do
......
...@@ -30,7 +30,7 @@ module Tooling ...@@ -30,7 +30,7 @@ module Tooling
].freeze ].freeze
def missing_labels def missing_labels
return [] unless helper.ci? return [] if !helper.ci? || helper.mr_has_labels?('growth experiment')
labels = [] labels = []
labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence') labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence')
......
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