Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Changelog instead of Release Notes for danger bot #22395

Closed
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(
radko93 marked this conversation as resolved.
Show resolved Hide resolved
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