blob: 4427c331b8e86887834a52b017188779637cade6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
module Gitlab
module Danger
module Changelog
NO_CHANGELOG_LABELS = [
'tooling',
'tooling::pipelines',
'tooling::workflow',
'ci-build',
'meta'
].freeze
NO_CHANGELOG_CATEGORIES = %i[docs none].freeze
def needed?
categories_need_changelog? && without_no_changelog_label?
end
def found
@found ||= git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
end
def sanitized_mr_title
gitlab.mr_json["title"].gsub(/^WIP: */, '').gsub(/`/, '\\\`')
end
def ee_changelog?
found.start_with?('ee/')
end
private
def categories_need_changelog?
(helper.changes_by_category.keys - NO_CHANGELOG_CATEGORIES).any?
end
def without_no_changelog_label?
(gitlab.mr_labels & NO_CHANGELOG_LABELS).empty?
end
end
end
end
|