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
This commit is contained in:
Héctor Ramos
2017-08-16 20:55:18 -07:00
committed by Facebook Github Bot
parent 381f738107
commit 2c076cdbdf
3 changed files with 63 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
React Native GitHub Issue Task Force: AndrewJack, astreet, bestander, brentvatne, browniefed, cancan101, charpeni, chirag04, christopherdro, corbt, cosmith, damusnet, DanielMSchmidt, davidaurelio, dmmiller, dsibiski, foghina, frantic, gantman, geirman, grabbou, gre, ide, janicduplessis, javache, jaygarcia, jsierles, kmagiera, knowbody, kmagiera, Kureev, lelandrichardson, martinbigio, melihmucuk, mkonicek, ncuillery, rmevans9, rt2zz, ryankask, satya164, skevy, tabrindle, vjeux
React Native GitHub Issue Task Force: AndrewJack, astreet, bestander, brentvatne, browniefed, cancan101, charpeni, chirag04, christopherdro, corbt, cosmith, damusnet, DanielMSchmidt, davidaurelio, dmmiller, dsibiski, facebook-open-source-bot, foghina, frantic, gantman, geirman, grabbou, gre, ide, janicduplessis, javache, jaygarcia, jsierles, kmagiera, knowbody, kmagiera, Kureev, lelandrichardson, martinbigio, melihmucuk, mkonicek, ncuillery, rmevans9, rt2zz, ryankask, satya164, skevy, tabrindle, vjeux
@facebook-github-bot answered
comment Closing this issue as {author} says the question asked has been answered.
@@ -34,6 +34,11 @@ close
comment {author} has closed this issue. If you think it should remain open, let us know why. See ["What to Expect from Maintainers"](https://facebook.github.io/react-native/docs/maintainers.html#handling-issues).
close
@facebook-github-bot large-pr
comment Thank you for your contribution. Unfortunately, this pull request seems relatively large.<br/><br/>In order to reduce the load on maintainers, it would be valuable if you could [split this into small, targeted PRs that changed one thing at a time](https://graysonkoonce.com/stacked-pull-requests-keeping-github-diffs-small/).<br/><br/>If doing this requires more than a few pull requests, please open (or update) an issue specifying your goal and the different steps you will take in your PRs. This will ensure maintainers have context on the relationship between the PRs.<br/><br/>We have added the tag large-pr and closed this task. If this is a codemod or other formatting change that is simple but inherently touches many files, please comment on this and let us know and we will reopen the PR.
add-label Large PR
close
@facebook-github-bot bugfix
comment Hey {issue_author}, if you're sure this is a bug, can you send a pull request with a fix?
add-label Help Wanted