Add Internal and JavaScript categories (#24744)

Summary:
So far we have only officially supported "iOS" and "Android" as categories, with a "General" catch all for everything else.
Let's add a "JavaScript" category for changes that only affect JavaScript, and an "Internal" category for things that do not make sense in a changelog (e.g. CI changes).

[Internal] [Added] - Added JavaScript and Internal categories to changelog regex
Pull Request resolved: https://github.com/facebook/react-native/pull/24744

Differential Revision: D15258061

Pulled By: cpojer

fbshipit-source-id: 8b6cb193adf602d3bd6639b550e04775b201fe59
This commit is contained in:
Héctor Ramos
2019-05-08 03:13:36 -07:00
committed by Facebook Github Bot
parent c802d0b757
commit b4b9c0f6fe

View File

@@ -55,7 +55,7 @@ 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)\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 includesChangelog =
danger.github.pr.body &&
(danger.github.pr.body.toLowerCase().includes('## changelog') ||
@@ -64,7 +64,7 @@ const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body);
// Provides advice if a changelog is missing
const changelogInstructions =
'A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.\n\n<details>CATEGORY may be:\n\n- General\n- iOS\n- Android\n\nTYPE may be:\n\n- Added, for new features.\n- Changed, for changes in existing functionality.\n- Deprecated, for soon-to-be removed features.\n- Removed, for now removed features.\n- Fixed, for any bug fixes.\n- Security, in case of vulnerabilities.\n\nMESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.</details>';
'A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.\n\n<details>CATEGORY may be:\n\n- General\n- iOS\n- Android\n- JavaScript\n- Internal (for changes that do not need to be called out in the release notes)\n\nTYPE may be:\n\n- Added, for new features.\n- Changed, for changes in existing functionality.\n- Deprecated, for soon-to-be removed features.\n- Removed, for now removed features.\n- Fixed, for any bug fixes.\n- Security, in case of vulnerabilities.\n\nMESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.</details>';
if (!includesChangelog) {
const title = ':clipboard: Missing Changelog';
const idea =
@@ -73,8 +73,8 @@ if (!includesChangelog) {
changelogInstructions;
message(`${title} - <i>${idea}</i>`);
} else if (!correctlyFormattedChangelog) {
const title = ':clipboard: Changelog Format';
const idea = 'Did you include a Changelog? ' + changelogInstructions;
const title = ':clipboard: Verify Changelog Format';
const idea = changelogInstructions;
message(`${title} - <i>${idea}</i>`);
}