Skip to content

Commit 706888d

Browse files
radko93facebook-github-bot
authored andcommitted
Use Changelog instead of Release Notes for danger bot (#22395)
Summary: In #22117 we changed the PR template to use `Changelog` instead of `Release notes` and now danger bot is complaining as it wasn't updated there. cc turnrye Pull Request resolved: #22395 Differential Revision: D13195006 Pulled By: TheSavior fbshipit-source-id: 36b9675c1e30c86fb8d002b121cc29239d6f78dd
1 parent 00681c3 commit 706888d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

bots/dangerfile.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,19 @@ if (!includesTestPlan) {
3939
}
4040

4141
// Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups
42-
const releaseNotesRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi;
43-
const includesReleaseNotes =
42+
const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-\s*?(.*)/gi;
43+
const includesChangelog =
4444
danger.github.pr.body &&
45-
danger.github.pr.body.toLowerCase().includes('release notes');
46-
const correctlyFormattedReleaseNotes = releaseNotesRegex.test(
47-
danger.github.pr.body,
48-
);
45+
danger.github.pr.body.toLowerCase().includes('changelog');
46+
const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body);
4947

50-
if (!includesReleaseNotes) {
51-
const title = ':clipboard: Release Notes';
52-
const idea = 'This PR appears to be missing Release Notes.';
48+
if (!includesChangelog) {
49+
const title = ':clipboard: Changelog';
50+
const idea = 'This PR appears to be missing Changelog.';
5351
warn(`${title} - <i>${idea}</i>`);
54-
} else if (!correctlyFormattedReleaseNotes) {
55-
const title = ':clipboard: Release Notes';
56-
const idea = 'This PR may have incorrectly formatted Release Notes.';
52+
} else if (!correctlyFormattedChangelog) {
53+
const title = ':clipboard: Changelog';
54+
const idea = 'This PR may have incorrectly formatted Changelog.';
5755
warn(`${title} - <i>${idea}</i>`);
5856
}
5957

0 commit comments

Comments
 (0)