Commit 3e573142 authored by Rémy Coutable's avatar Rémy Coutable

Improve danger/changelog/Dangerfile to include the title in the bin/changelog command

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 0c1accd5
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
require 'yaml' require 'yaml'
NO_CHANGELOG_LABELS = %w[backstage QA test].freeze NO_CHANGELOG_LABELS = %w[backstage Documentation QA test].freeze
SEE_DOC = "See [the documentation](https://docs.gitlab.com/ce/development/changelog.html).".freeze SEE_DOC = "See [the documentation](https://docs.gitlab.com/ce/development/changelog.html).".freeze
MISSING_CHANGELOG_MESSAGE = <<~MSG.freeze CREATE_CHANGELOG_MESSAGE = <<~MSG.freeze
**[CHANGELOG missing](https://docs.gitlab.com/ce/development/changelog.html).**
You can create one with: You can create one with:
``` ```
bin/changelog -m %<mr_iid>s bin/changelog -m %<mr_iid>s "%<mr_title>s"
``` ```
If your merge request doesn't warrant a CHANGELOG entry, If your merge request doesn't warrant a CHANGELOG entry,
...@@ -56,13 +54,15 @@ changelog_needed = (gitlab.mr_labels & NO_CHANGELOG_LABELS).empty? ...@@ -56,13 +54,15 @@ changelog_needed = (gitlab.mr_labels & NO_CHANGELOG_LABELS).empty?
changelog_found = git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} } changelog_found = git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
if git.modified_files.include?("CHANGELOG.md") if git.modified_files.include?("CHANGELOG.md")
fail "CHANGELOG.md was edited. Please remove the additions and create an entry with `bin/changelog -m #{gitlab.mr_json["iid"]}` instead." fail "**CHANGELOG.md was edited.** Please remove the additions and create a CHANGELOG entry.\n\n" +
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: gitlab.mr_json["title"], labels: presented_no_changelog_labels)
end end
if changelog_needed if changelog_needed
if changelog_found if changelog_found
check_changelog(changelog_found) check_changelog(changelog_found)
else else
warn format(MISSING_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], labels: presented_no_changelog_labels) warn "**[CHANGELOG missing](https://docs.gitlab.com/ce/development/changelog.html).**\n\n" +
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: gitlab.mr_json["title"], labels: presented_no_changelog_labels)
end end
end end
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