From c7a596534facc83b77221d178866a502000ad2a8 Mon Sep 17 00:00:00 2001 From: Hector Ramos Date: Wed, 19 Jul 2017 01:31:44 -0700 Subject: [PATCH] Update Dangerfile, fix flagging IssueCommands.txt changes Summary: The bot was incorrectly flagging PRs that do not touch IssueCommands.txt. This PR fixes the Dangerfile rule. Verify the warning is generated on a PR that touches IssuesCommands.txt: ``` $ DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger pr https://github.com/facebook/react-native/pull/15087 > @ danger /Users/hramos/git/react-native/danger > node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/15087" { fails: [], warnings: [ { message: ":clipboard: Test Plan - This PR appears to be missing a Test Plan." }, { message: ":exclamation: Bots - This PR appears to modify the list of people that may issue commands to the GitHub bot." } ], messages: [], markdowns: [] } ``` Verify it does not warn on a PR that does not modify IssueCommands.txt: ``` $ DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger pr https://github.com/facebook/react-native/pull/15089 > @ danger /Users/hramos/git/react-native/danger > node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/15089" { fails: [], warnings: [], messages: [], markdowns: [] } ``` Closes https://github.com/facebook/react-native/pull/15090 Differential Revision: D5451092 Pulled By: hramos fbshipit-source-id: 54f0426871391153db81ab02d3d1b3b7f1e75fac --- danger/dangerfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danger/dangerfile.js b/danger/dangerfile.js index 24bbb7335..b66fd0ac5 100644 --- a/danger/dangerfile.js +++ b/danger/dangerfile.js @@ -95,8 +95,8 @@ if (isSubmittedByTaskforce) { } // Warns if the bots whitelist file is updated. -const isBotsCommandsFile = path => includes(path, 'bots/IssueCommands.txt'); -if (isBotsCommandsFile) { +const issueCommandsFileModified = includes(danger.git.modified_files, 'bots/IssueCommands.txt'); +if (issueCommandsFileModified) { const message = ':exclamation: Bots'; const idea = 'This PR appears to modify the list of people that may issue commands to the ' + 'GitHub bot.';