react-native-macos/packages/react-native-bots
Luna Wei 767f8e0249 Add bots as a yarn workspace and update danger action (#34652)
Summary:
allow-large-files

When working on https://github.com/facebook/react-native/pull/34614, danger is failing because it doesn't share `node_modules` with the root directory where `typescript` is installed as we added it as a parser in our eslint config.

By setting `bots` as a yarn workspace, dependencies are all installed under the root `node_modules` folder and in local testing (detailed in test section) we no longer have the `typescript module not found` error. However, danger will continue to fail on https://github.com/facebook/react-native/pull/34614 as the `danger_pr` Github action runs from what's defined on `main`.

Once these changes land, I can rebase https://github.com/facebook/react-native/pull/34614 on it and danger's eslint should pass.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Internal][Fixed] - Add `bots` directory as a yarn workspace and update `danger_pr` Github action

Pull Request resolved: https://github.com/facebook/react-native/pull/34652

Test Plan:
To verify this fix I had to run:
```
react-native $ yarn && cd bots
react-native/bots$ yarn run danger pr https://github.com/facebook/react-native/pull/34614
```

which resulted in
```
❯ yarn run danger pr https://github.com/facebook/react-native/pull/34614
yarn run v1.22.19
$ lunaleaps/react-native/node_modules/.bin/danger pr https://github.com/facebook/react-native/pull/34614
Starting Danger PR on facebook/react-native#34614

Danger: ✓ found only warnings, not failing the build
## Warnings
🔒 package.json - <i>Changes were made to package.json. This will require a manual import by a Facebook employee.</i>

  Done in 12.78s.
```
Verified this also on another PR:
```
yarn run danger pr https://github.com/facebook/react-native/pull/34650
```

Reviewed By: NickGerleman

Differential Revision: D39435286

Pulled By: lunaleaps

fbshipit-source-id: 8c82f49facf162f4fc0918e3abd95eb7e4ad1e37
2022-09-12 22:03:34 -07:00
..
.babelrc Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
README.md Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
code-analysis-bot.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
dangerfile.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
datastore.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
make-comment.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
package.json Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
post-artifacts-link.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00
report-bundle-size.js Add bots as a yarn workspace and update danger action (#34652) 2022-09-12 22:03:34 -07:00

README.md

Danger

Danger is a JavaScript runtime which helps you provide continuous feedback inside GitHub. It's used inside Github Actions to analyze the contents of a GitHub pull request.

If you want to test changes to Danger, I'd recommend checking out an existing PR and then running the danger pr command. You'll need a GitHub Public Access Token (PAT). It will look like ghp_<REDACTED>.

So, for example:

DANGER_GITHUB_API_TOKEN=ghp_<REDACTED> yarn danger pr https://github.com/facebook/react-native/pull/1234

Code Analysis Bot

The code analysis bot provides lint and other results as inline reviews on GitHub. It runs as part of the Circle CI analysis workflow.

If you want to test changes to the Code Analysis Bot, I'd recommend checking out an existing PR and then running the analyze pr command. You'll need a GitHub token. You can re-use this one: 312d354b5c36f082cfe9 07973d757026bdd9f196 (just remove the space). So, for example:

GITHUB_TOKEN=[ENV_ABOVE] GITHUB_PR_NUMBER=1234 yarn lint-ci