From f5802e97d1074cd1bbccb5998bebb574e3d4202a Mon Sep 17 00:00:00 2001 From: Radek Czemerys Date: Fri, 23 Nov 2018 13:15:02 +0200 Subject: [PATCH 1/3] Switch to Changelog naming for danger bot --- bots/dangerfile.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bots/dangerfile.js b/bots/dangerfile.js index 9c29f56c7a1f6e..9d6f04a7775086 100644 --- a/bots/dangerfile.js +++ b/bots/dangerfile.js @@ -39,21 +39,21 @@ if (!includesTestPlan) { } // Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups -const releaseNotesRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi; -const includesReleaseNotes = +const changelogNotesRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi; +const includesChangelog = danger.github.pr.body && - danger.github.pr.body.toLowerCase().includes('release notes'); -const correctlyFormattedReleaseNotes = releaseNotesRegex.test( + danger.github.pr.body.toLowerCase().includes('changelog'); +const correctlyFormattedChangelog = changelogNotesRegex.test( danger.github.pr.body, ); -if (!includesReleaseNotes) { - const title = ':clipboard: Release Notes'; - const idea = 'This PR appears to be missing Release Notes.'; +if (!includesChangelog) { + const title = ':clipboard: Changelog'; + const idea = 'This PR appears to be missing Changelog.'; warn(`${title} - ${idea}`); -} else if (!correctlyFormattedReleaseNotes) { - const title = ':clipboard: Release Notes'; - const idea = 'This PR may have incorrectly formatted Release Notes.'; +} else if (!correctlyFormattedChangelog) { + const title = ':clipboard: Changelog'; + const idea = 'This PR may have incorrectly formatted Changelog.'; warn(`${title} - ${idea}`); } From a84a6e4c4f7d98eb574fe75c579f17b33296d375 Mon Sep 17 00:00:00 2001 From: Radek Czemerys Date: Mon, 26 Nov 2018 13:19:27 +0200 Subject: [PATCH 2/3] Naming fix --- bots/dangerfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bots/dangerfile.js b/bots/dangerfile.js index 9d6f04a7775086..ca2c78a48bbdd4 100644 --- a/bots/dangerfile.js +++ b/bots/dangerfile.js @@ -39,11 +39,11 @@ if (!includesTestPlan) { } // Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups -const changelogNotesRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi; +const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi; const includesChangelog = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('changelog'); -const correctlyFormattedChangelog = changelogNotesRegex.test( +const correctlyFormattedChangelog = changelogRegex.test( danger.github.pr.body, ); From b98d9ef9f4164787cfb0d73533b9187f56085398 Mon Sep 17 00:00:00 2001 From: Radek Czemerys Date: Tue, 27 Nov 2018 10:14:47 +0200 Subject: [PATCH 3/3] Fix lint error --- bots/dangerfile.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bots/dangerfile.js b/bots/dangerfile.js index ca2c78a48bbdd4..422f960422a715 100644 --- a/bots/dangerfile.js +++ b/bots/dangerfile.js @@ -43,9 +43,7 @@ const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|D const includesChangelog = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('changelog'); -const correctlyFormattedChangelog = changelogRegex.test( - danger.github.pr.body, -); +const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body); if (!includesChangelog) { const title = ':clipboard: Changelog';