diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-24 03:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-24 03:09:26 +0300 |
commit | 27f3465d8a52afce630417b6e4b58992b6e403fe (patch) | |
tree | 55a48a13e9db76ca804ecba4b5ffa12a65076944 /tooling/danger | |
parent | 78f935d56652eee385683bf7a55c3b9a86a63a0e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'tooling/danger')
-rw-r--r-- | tooling/danger/changelog.rb | 36 | ||||
-rw-r--r-- | tooling/danger/project_helper.rb | 2 |
2 files changed, 22 insertions, 16 deletions
diff --git a/tooling/danger/changelog.rb b/tooling/danger/changelog.rb index 672d23d58e4..065c737050e 100644 --- a/tooling/danger/changelog.rb +++ b/tooling/danger/changelog.rb @@ -18,29 +18,35 @@ module Tooling CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and create a CHANGELOG entry.\n\n" CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:\n\n" - OPTIONAL_CHANGELOG_MESSAGE = <<~MSG - If you want to create a changelog entry for GitLab FOSS, run the following: + OPTIONAL_CHANGELOG_MESSAGE = { + local: "If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.", + ci: <<~MSG + If you want to create a changelog entry for GitLab FOSS, run the following: - #{CREATE_CHANGELOG_COMMAND} + #{CREATE_CHANGELOG_COMMAND} - If you want to create a changelog entry for GitLab EE, run the following instead: + If you want to create a changelog entry for GitLab EE, run the following instead: - #{CREATE_EE_CHANGELOG_COMMAND} + #{CREATE_EE_CHANGELOG_COMMAND} - If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message. - MSG + If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message. + MSG + }.freeze REQUIRED_CHANGELOG_REASONS = { db_changes: 'introduces a database migration', feature_flag_removed: 'removes a feature flag' }.freeze - REQUIRED_CHANGELOG_MESSAGE = <<~MSG - To create a changelog entry, run the following: + REQUIRED_CHANGELOG_MESSAGE = { + local: "This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry).", + ci: <<~MSG + To create a changelog entry, run the following: - #{CREATE_CHANGELOG_COMMAND} + #{CREATE_CHANGELOG_COMMAND} - This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry). - MSG + This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry). + MSG + }.freeze def required_reasons [].tap do |reasons| @@ -67,20 +73,20 @@ module Tooling def modified_text CHANGELOG_MODIFIED_URL_TEXT + - format(OPTIONAL_CHANGELOG_MESSAGE, mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) + (helper.ci? ? format(OPTIONAL_CHANGELOG_MESSAGE[:ci], mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) : OPTIONAL_CHANGELOG_MESSAGE[:local]) end def required_texts required_reasons.each_with_object({}) do |required_reason, memo| memo[required_reason] = CHANGELOG_MISSING_URL_TEXT + - format(REQUIRED_CHANGELOG_MESSAGE, reason: REQUIRED_CHANGELOG_REASONS.fetch(required_reason), mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) + (helper.ci? ? format(REQUIRED_CHANGELOG_MESSAGE[:ci], reason: REQUIRED_CHANGELOG_REASONS.fetch(required_reason), mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) : REQUIRED_CHANGELOG_MESSAGE[:local]) end end def optional_text CHANGELOG_MISSING_URL_TEXT + - format(OPTIONAL_CHANGELOG_MESSAGE, mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) + (helper.ci? ? format(OPTIONAL_CHANGELOG_MESSAGE[:ci], mr_iid: helper.mr_iid, mr_title: sanitized_mr_title) : OPTIONAL_CHANGELOG_MESSAGE[:local]) end private diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb index 9291b725af2..2c4d40f50ee 100644 --- a/tooling/danger/project_helper.rb +++ b/tooling/danger/project_helper.rb @@ -4,6 +4,7 @@ module Tooling module Danger module ProjectHelper LOCAL_RULES ||= %w[ + changelog changes_size commit_messages database @@ -20,7 +21,6 @@ module Tooling CI_ONLY_RULES ||= %w[ ce_ee_vue_templates - changelog ci_templates metadata feature_flag |