Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 18:08:41 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-12 18:08:41 +0300
commit27859ed5eaeae234162b7cce7fd8bd351b5f9369 (patch)
tree5a62db348c3fd73516df87262c78e3546d4ec770 /lib/gitlab/danger
parent784fae4b9d7e92350075df2a43d06893080ed1e6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/danger')
-rw-r--r--lib/gitlab/danger/changelog.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/gitlab/danger/changelog.rb b/lib/gitlab/danger/changelog.rb
new file mode 100644
index 00000000000..b53516081be
--- /dev/null
+++ b/lib/gitlab/danger/changelog.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Danger
+ module Changelog
+ NO_CHANGELOG_LABELS = %w[backstage ci-build meta].freeze
+ NO_CHANGELOG_CATEGORIES = %i[docs none].freeze
+
+ def needed?
+ categories_need_changelog? && (gitlab.mr_labels & NO_CHANGELOG_LABELS).empty?
+ end
+
+ def found
+ git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
+ end
+
+ def presented_no_changelog_labels
+ NO_CHANGELOG_LABELS.map { |label| "~#{label}" }.join(', ')
+ end
+
+ def sanitized_mr_title
+ gitlab.mr_json["title"].gsub(/^WIP: */, '').gsub(/`/, '\\\`')
+ end
+
+ def ee_changelog?(changelog_path)
+ changelog_path =~ /unreleased-ee/
+ end
+
+ def ce_port_changelog?(changelog_path)
+ helper.ee? && !ee_changelog?(changelog_path)
+ end
+
+ private
+
+ def categories_need_changelog?
+ (helper.changes_by_category.keys - NO_CHANGELOG_CATEGORIES).any?
+ end
+ end
+ end
+end