Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Circle] Update danger token #18111

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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