Skip to content

Commit

Permalink
Update danger token
Browse files Browse the repository at this point in the history
Summary: Closes #18111

Differential Revision: D7099636

Pulled By: hramos

fbshipit-source-id: fc95ba83c34e0061c13fb831ea3496d7e8f3793a
  • Loading branch information
hramos authored and facebook-github-bot committed Feb 27, 2018
1 parent b60a727 commit c87d03a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,15 +547,17 @@ jobs:
- run:
name: Analyze Pull Request
command: |
# DANGER_GITHUB_API_TOKEN=Facebook-Open-Source-Bot public_repo access token
if [ -n "$CIRCLE_PR_NUMBER" ]; then
cd bots && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" yarn danger
cd bots && DANGER_GITHUB_API_TOKEN="b186c9a82bab3b08ec80""c0818117619eec6f281a" yarn danger
else
echo "Skipping pull request analysis."
fi
when: always
- run:
name: Analyze Code
command: |
# GITHUB_TOKEN=eslint-bot public_repo access token
if [ -n "$CIRCLE_PR_NUMBER" ]; then
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
else
Expand Down
4 changes: 2 additions & 2 deletions bots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ If you'd like to make changes to the Dangerfile, find an existing PR on the Reac
Then, run from the React Native root directory:

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

And you will get the responses from parsing the Dangerfile.
14 changes: 2 additions & 12 deletions bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (!includesTestPlan) {

// 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 includesReleaseNotes = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('release notes');
const correctlyFormattedReleaseNotes = releaseNotesRegex.test(danger.github.pr.body);
const releaseNotesCaptureGroups = releaseNotesRegex.exec(danger.github.pr.body);

Expand Down Expand Up @@ -86,24 +86,14 @@ if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) {
warn(`${title} - <i>${idea}</i>`);

// markdown('@facebook-github-bot large-pr');
}
if (danger.git.modified_files + danger.git.added_files + danger.git.deleted_files > bigPRThreshold) {
} else if (danger.git.modified_files + danger.git.added_files + danger.git.deleted_files > bigPRThreshold) {
const title = ':exclamation: Big PR';
const idea = `This PR is extremely unlikely to get reviewed because it touches ${danger.git.modified_files + danger.git.added_files + danger.git.deleted_files} files.`;
warn(`${title} - <i>${idea}</i>`);

// markdown('@facebook-github-bot large-pr');
}

// Warns if the bots whitelist file is updated.
const issueCommandsFileModified = includes(danger.git.modified_files, 'bots/IssueCommands.txt');
if (issueCommandsFileModified) {
const title = ':exclamation: Bots';
const idea = 'This PR appears to modify the list of people that may issue ' +
'commands to the GitHub bot.';
warn(`${title} - <i>${idea}</i>`);
}

// Warns if the PR is opened against stable, as commits need to be cherry picked and tagged by a release maintainer.
// Fails if the PR is opened against anything other than `master` or `-stable`.
const isMergeRefMaster = danger.github.pr.base.ref === 'master';
Expand Down

0 comments on commit c87d03a

Please sign in to comment.