Commit d46e8778 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'am-update-product-intelligence-danger' into 'master'

Skip Product Intelligence review for growth experiments MRs

See merge request gitlab-org/gitlab!70907
parents 9ca619e5 aec6886a
......@@ -10,14 +10,13 @@ Please check the ~"product intelligence" [guide](https://docs.gitlab.com/ee/deve
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
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
return unless labels.any?
warn format(CHANGED_FILES_MESSAGE, changed_files: helper.markdown_list(matching_changed_files))
gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
gitlab.mr_json['iid'],
......
......@@ -99,6 +99,9 @@ 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")
# Skip Product intelligence reviews for growth experiment MRs
categories.delete(:product_intelligence) unless helper.mr_labels.include?("growth experiment")
if changes.any?
project = project_helper.project_name
......
......@@ -59,6 +59,14 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
it { is_expected.to be_empty }
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
describe '#matching_changed_files' do
......
......@@ -30,7 +30,7 @@ module Tooling
].freeze
def missing_labels
return [] unless helper.ci?
return [] if !helper.ci? || helper.mr_has_labels?('growth experiment')
labels = []
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