Skip to content

Commit

Permalink
Loosen up restrictions for internal changelogs (facebook#28486)
Browse files Browse the repository at this point in the history
Summary:
Do not nag on PRs that contain internal changelogs (meaning, the change doesn't need to be called out in release notes).

## Changelog

[Internal] - This should be acceptable.
Pull Request resolved: facebook#28486

Test Plan: See PR.

Reviewed By: cpojer

Differential Revision: D20817454

Pulled By: hramos

fbshipit-source-id: a7082c4db05ec53ad27349db7e5bce2cfffd6930
  • Loading branch information
hramos authored and facebook-github-bot committed Apr 2, 2020
1 parent 2c3a6ab commit 46f4109
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ if (!includesTestPlan) {
}

// Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups
const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS|JS|JAVASCRIPT|INTERNAL)\s?\]\s*?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?\-?\s*?(.*)/gi;
const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS|JS|JAVASCRIPT|INTERNAL)\s?\]\s?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?-?\s*?(.*)/gi;
const internalChangelogRegex = /\[\s?(INTERNAL)\s?\].*/gi;
const includesChangelog =
danger.github.pr.body &&
(danger.github.pr.body.toLowerCase().includes('## changelog') ||
danger.github.pr.body.toLowerCase().includes('release notes'));
const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body);
const containsInternalChangelog = internalChangelogRegex.test(
danger.github.pr.body,
);

// Provides advice if a changelog is missing
const changelogInstructions =
Expand All @@ -68,7 +72,7 @@ if (!includesChangelog) {
'To do so, add a "## Changelog" section to your PR description. ' +
changelogInstructions;
message(`${title} - <i>${idea}</i>`);
} else if (!correctlyFormattedChangelog) {
} else if (!correctlyFormattedChangelog && !containsInternalChangelog) {
const title = ':clipboard: Verify Changelog Format';
const idea = changelogInstructions;
message(`${title} - <i>${idea}</i>`);
Expand Down

0 comments on commit 46f4109

Please sign in to comment.