diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-06-02 12:20:25 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-06-02 12:20:25 +0300 |
commit | 08fa50ebd5fd086575958da1409b23b6948ad1d4 (patch) | |
tree | 0ec60d52b34b787d97113dae4389b14900c1f9fc | |
parent | e078d5bd7c5eb37caa222faa15010ce6decc6aa6 (diff) | |
parent | 56d5110d074c897172342401299587f204511c6a (diff) |
Merge branch 'changelog-trailer-casing' into 'master'
Ensure trailers use the right casing
See merge request gitlab-org/gitaly!3558
-rw-r--r-- | danger/changelog/Dangerfile | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 56efe44de..0aa9ff9ee 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -1,10 +1,20 @@ require 'yaml' def lint_commit(commit) - trailer = commit.message.match(/^Changelog:\s*(?<category>\w+)/) + trailer = commit.message.match(/^(?<name>Changelog):\s*(?<category>.+)$/i) return :missing if trailer.nil? || trailer[:category].nil? + name = trailer[:name] + + unless name == 'Changelog' + self.fail( + "The changelog trailer for commit #{commit.sha} must be `Changelog` (starting with a capital C), not `#{name}`" + ) + + return :invalid + end + category = trailer[:category] return :valid if CATEGORIES.include?(category) |