Loosen up restrictions for internal changelogs (#28486)

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: https://github.com/facebook/react-native/pull/28486

Test Plan: See PR.

Reviewed By: cpojer

Differential Revision: D20817454

Pulled By: hramos

fbshipit-source-id: a7082c4db05ec53ad27349db7e5bce2cfffd6930
This commit is contained in:
Héctor Ramos 2020-04-02 12:47:47 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 2c3a6ab5b2
Коммит 46f41099e7
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -51,12 +51,16 @@ if (!includesTestPlan) {
} }
// Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups // 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 = const includesChangelog =
danger.github.pr.body && danger.github.pr.body &&
(danger.github.pr.body.toLowerCase().includes('## changelog') || (danger.github.pr.body.toLowerCase().includes('## changelog') ||
danger.github.pr.body.toLowerCase().includes('release notes')); danger.github.pr.body.toLowerCase().includes('release notes'));
const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body); const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body);
const containsInternalChangelog = internalChangelogRegex.test(
danger.github.pr.body,
);
// Provides advice if a changelog is missing // Provides advice if a changelog is missing
const changelogInstructions = const changelogInstructions =
@ -68,7 +72,7 @@ if (!includesChangelog) {
'To do so, add a "## Changelog" section to your PR description. ' + 'To do so, add a "## Changelog" section to your PR description. ' +
changelogInstructions; changelogInstructions;
message(`${title} - <i>${idea}</i>`); message(`${title} - <i>${idea}</i>`);
} else if (!correctlyFormattedChangelog) { } else if (!correctlyFormattedChangelog && !containsInternalChangelog) {
const title = ':clipboard: Verify Changelog Format'; const title = ':clipboard: Verify Changelog Format';
const idea = changelogInstructions; const idea = changelogInstructions;
message(`${title} - <i>${idea}</i>`); message(`${title} - <i>${idea}</i>`);