react-native/danger
Héctor Ramos 2c076cdbdf Flag large pull requests, add large-pr command
Summary:
We sometimes get large PRs that sit for a long time without being reviewed. In some cases, the PR touches too many files or lines, and the author would benefit from splitting the PR into smaller easier-to-review PRs. In this PR, we automatically flag such PRs using the existing Danger PR automation functionality.

This PR achieves the objective by doing the following:

* Add facebook-open-source-bot to `IssueCommands.txt`, allowing it to add labels and close issues/PRs via facebook-github-bot commands.
* Adds a `large-pr` command to facebook-github-bot. This command will add a short blurb, apply a new "Large PR" label, and close the PR.
* Updates the Dangerfile to check for PRs that touch over 600 lines and/or files. In such cases it will warn and then issue the large-pr command.

Additional changes:

* Tag core contributor PRs with the "Core Team" label. This is a slight change in policy, in that the label used to be applied after the fact (after the PR was escalated for review). It's more convenient to monitor labels, so we'll start checking for PRs tagged as such and ensure they get escalated as needed. cc skevy

Thanks to TheSavior for suggesting this change.

Testing against PR #10084 which touches over 600 lines:

```
$ cd danger
$ DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger pr https://github.com/facebook/react-native/pull/10084

> @ danger /Users/hramos/git/react-native/danger
> node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/10084"

{
  fails: [],
  warnings: [
    {
      message: "📋 Test Plan - <i>This PR appears to be missing a Test Plan.</i>"
    },
    {
      message: " Big PR - <i>This PR is extremely unlikely to get reviewed because it touches 613 lines.</i>"
    }
  ],
  messages: [],
  markdowns: ["facebook-github-bot label Needs more information", "facebook-github-bot large-pr"]
}
```

Result: successfully flagged as being a large PR.
Closes https://github.com/facebook/react-native/pull/15519

Differential Revision: D5647085

Pulled By: hramos

fbshipit-source-id: dfa0f6580b9373085eba856de257a8d2452efbdc
2017-08-16 21:00:44 -07:00
..
.babelrc Adds Danger support 2017-07-18 11:16:46 -07:00
README.md Adds Danger support 2017-07-18 11:16:46 -07:00
dangerfile.js Flag large pull requests, add large-pr command 2017-08-16 21:00:44 -07:00
package.json Warn if base !== master, tag CODEOWNERS 2017-07-25 12:16:15 -07:00

README.md

If you'd like to make changes to the Dangerfile, find an existing PR and copy the URL.

Then run from the React Native root:

cd danger
npm install
..
node danger/node_modules/.bin/danger pr https://github.com/facebook/react-native/pull/1		

And you will get the responses from parsing the Dangerfile.