Skip to content

Commit

Permalink
add release notes/changelog requirement to PR Template
Browse files Browse the repository at this point in the history
Summary:
grabbou has to write release notes for every release, and that's getting ridonc. Have you seen the changelog from 0.48?

PR writers need to do their own, hopefully in a standardized format so it can be scripted.

Just a PR template change, just proofreading needed. Please mention if have missed or added any extra Categories, Types, or Where columns.

Here's a sample:

[GENERAL] [ENHANCEMENT] [PULL_REQUEST_TEMPLATE.md] - added release notes/changelog requirement to PR Template
Closes #15874

Differential Revision: D6054557

Pulled By: hramos

fbshipit-source-id: 5741b98a0efdb1a6aaaeedaa292403b82ce713f6
  • Loading branch information
tabrindle authored and facebook-github-bot committed Oct 13, 2017
1 parent 2fff445 commit 9877c08
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,38 @@ Happy contributing!
-->

## Motivation

(Write your motivation here.)

## Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

## Release Notes
<!--
Help reviewers and the release process by writing your own release notes
**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**
CATEGORY
[----------] TYPE
[ CLI ] [-------------] LOCATION
[ DOCS ] [ BREAKING ] [-------------]
[ GENERAl ] [ BUGFIX ] [-{Component}-]
[ INTERNAL ] [ ENHANCEMENT ] [ {File} ]
[ IOS ] [ FEATURE ] [ {Directory} ] |-----------|
[ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} |
[----------] [-------------] [-------------] |-----------|
[CATEGORY] [TYPE] [LOCATION] - MESSAGE
EXAMPLES:
[IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
[ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
[CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
[DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
[GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
[INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
29 changes: 29 additions & 0 deletions danger/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,35 @@ if (!includesTestPlan && !editsDocs) {
markdown('@facebook-github-bot label Needs more information');
}

// Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups
const releaseNotesRegex = /\[(ANDROID|CLI|DOCS|GENERAL|INTERNAL|IOS|TVOS|WINDOWS)\]\s*?\[(BREAKING|BUGFIX|ENHANCEMENT|FEATURE|MINOR)\]\s*?\[(.*)\]\s*?\-\s*?(.*)/ig;
const includesReleaseNotes = danger.github.pr.body.toLowerCase().includes('release notes');
const correctlyFormattedReleaseNotes = releaseNotesRegex.test(danger.github.pr.body);
const releaseNotesCaptureGroups = releaseNotesRegex.exec(danger.github.pr.body);

if (!includesReleaseNotes) {
const title = ':clipboard: Release Notes';
const idea = 'This PR appears to be missing Release Notes.';
warn(`${title} - <i>${idea}</i>`);
markdown('@facebook-github-bot label Needs more information');
} else if (!correctlyFormattedReleaseNotes) {
const title = ':clipboard: Release Notes';
const idea = 'This PR may have incorrectly formatted Release Notes.';
warn(`${title} - <i>${idea}</i>`);
markdown('@facebook-github-bot label Needs more information');
} else if (releaseNotesCaptureGroups) {
const category = releaseNotesCaptureGroups[1].toLowerCase();

// Use Release Notes to Tag PRs appropriately
if (category === 'ios' ){
markdown('@facebook-github-bot label iOS');
}

if (category === 'android' ){
markdown('@facebook-github-bot label Android');
}
}

// Tags PRs that have been submitted by a core contributor.
// TODO: Switch to using an actual MAINTAINERS file.
const taskforce = fs.readFileSync('../bots/IssueCommands.txt', 'utf8').split('\n')[0].split(':')[1];
Expand Down

0 comments on commit 9877c08

Please sign in to comment.