Skip to content

Commit

Permalink
Add bots as a yarn workspace and update danger action (#34652)
Browse files Browse the repository at this point in the history
Summary:
allow-large-files

When working on #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 #34614 as the `danger_pr` Github action runs from what's defined on `main`.

Once these changes land, I can rebase #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: #34652

Test Plan:
To verify this fix I had to run:
```
react-native $ yarn && cd bots
react-native/bots$ yarn run danger pr #34614
```

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

Danger: ✓ found only warnings, not failing the build
## Warnings
:lock: 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 #34650
```

Reviewed By: NickGerleman

Differential Revision: D39435286

Pulled By: lunaleaps

fbshipit-source-id: 8c82f49facf162f4fc0918e3abd95eb7e4ad1e37
  • Loading branch information
Luna Wei authored and facebook-github-bot committed Sep 13, 2022
1 parent bfb36c2 commit 767f8e0
Show file tree
Hide file tree
Showing 13 changed files with 1,331 additions and 1,711 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ commands:
- ~/.cache/yarn
key: << parameters.yarn_base_cache_key >>-{{ arch }}-{{ checksum "yarn.lock" }}

install_github_bot_deps:
steps:
- run:
name: "Yarn: Install dependencies (GitHub bots)"
command: cd bots && yarn install --non-interactive --cache-folder ~/.cache/yarn

brew_install:
parameters:
package:
Expand Down Expand Up @@ -247,7 +241,6 @@ commands:
type: enum
enum: ["android", "ios"]
steps:
- install_github_bot_deps
- run:
name: Report size of RNTester.app (analysis-bot)
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true
Expand Down Expand Up @@ -304,7 +297,6 @@ jobs:
- checkout
- run_yarn

- install_github_bot_deps

# Note: The yarn gpg key needs to be refreshed to work around https://github.com/yarnpkg/yarn/issues/7866
- run:
Expand Down Expand Up @@ -1291,7 +1283,6 @@ jobs:
condition:
matches: { pattern: '^pull\/.*$', value: << pipeline.git.branch >> }
steps:
- install_github_bot_deps
- run:
name: Post link to PR build artifacts (pull-bot)
command: GITHUB_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" scripts/circleci/post-artifacts-link.sh || true
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/danger_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ jobs:
- name: Run Yarn Install on Root
run: yarn install
working-directory: .
- name: Run Yarn Install inside Bots
run: yarn install
working-directory: bots
- name: Danger
run: yarn danger ci --use-github-checks --failOnErrors
working-directory: bots
working-directory: packages/react-native-bots
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 767f8e0

Please sign in to comment.