Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,19 @@ 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 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('release notes');
const correctlyFormattedReleaseNotes = releaseNotesRegex.test(
danger.github.pr.body,
);
danger.github.pr.body.toLowerCase().includes('changelog');
const correctlyFormattedChangelog = changelogRegex.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} - <i>${idea}</i>`);
} 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} - <i>${idea}</i>`);
}

Expand Down