debian-mirror-gitlab/tooling/danger/product_intelligence.rb

41 lines
899 B
Ruby
Raw Normal View History

2021-09-04 01:27:46 +05:30
# frozen_string_literal: true
# rubocop:disable Style/SignalException
module Tooling
module Danger
module ProductIntelligence
2022-01-26 12:08:38 +05:30
APPROVED_LABEL = 'product intelligence::approved'
REVIEW_LABEL = 'product intelligence::review pending'
2021-09-04 01:27:46 +05:30
WORKFLOW_LABELS = [
2022-01-26 12:08:38 +05:30
APPROVED_LABEL,
REVIEW_LABEL
2021-09-04 01:27:46 +05:30
].freeze
def missing_labels
2022-01-26 12:08:38 +05:30
return [] unless helper.ci?
2021-09-04 01:27:46 +05:30
labels = []
labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence')
2022-01-26 12:08:38 +05:30
labels << REVIEW_LABEL unless has_workflow_labels?
2021-09-04 01:27:46 +05:30
labels
end
2022-01-26 12:08:38 +05:30
def has_approved_label?
helper.mr_labels.include?(APPROVED_LABEL)
end
def skip_review?
helper.mr_has_labels?('growth experiment')
end
2021-09-04 01:27:46 +05:30
private
2021-12-11 22:18:48 +05:30
def has_workflow_labels?
(WORKFLOW_LABELS & helper.mr_labels).any?
2021-09-04 01:27:46 +05:30
end
end
end
end