mirror of
https://github.com/react/react-native.git
synced 2026-09-28 21:33:11 +08:00
Summary: This adds an AI code review bot to React Native. It leaves a single comment on PRs with findings from three reviewers (correctness, security, consistency) and never blocks merging or auto-approves. How it works: - Config lives in `.expo-code-review/` — `config.jsonc`, shared prompts, and the three agent files. The model is `meta/muse-spark-1.2` (Muse Spark) using `META_API_KEY`. - Three workflows: auto-review on `pull_request`, on-demand `/review` comment, and `/dismiss` to hide a finding. They check out the base commit and run the published `expo/code-review-cli` via `npx`, so PR code is never executed. What changed: - Added `.expo-code-review/` with the config and prompts - Added `.github/workflows/expo-code-review.yml`, `expo-code-review-command.yml`, `expo-code-review-dismiss.yml` The bot is wired but dormant until the `META_API_KEY` secret is set (from https://developer.meta.com/ai/, stored as `EXPO_CODE_REVIEW_API_KEY` and forwarded as `META_API_KEY`). It now only runs when you add the `ai-review` label. ## Changelog: [INTERNAL] [ADDED] - Add expo/code-review-cli AI code review (Muse Spark) Pull Request resolved: https://github.com/react/react-native/pull/58021 Test Plan: Tested locally on `add-expo-code-review-muse-spark` (`Abbondanzo/react-native` fork): ```bash npx --yes expo/code-review-cli init --token-env META_API_KEY # set model to meta/muse-spark-1.2 in config.jsonc, workflows forward META_API_KEY from secrets.EXPO_CODE_REVIEW_API_KEY ECR_EXPECTED_TOKEN_ENV=META_API_KEY ecr verify-config # → OK — tokenEnv locked to META_API_KEY ecr doctor # → ✓ 3 agents (consistency, correctness, security), coordinator meta/muse-spark-1.2 ecr ref-check # → 1 ref(s) across 6 files — all resolve ecr review --json # → correctly waits for META_API_KEY ``` CI is `continue-on-error` and `pull-requests: write` only. After the secret is set, adding `ai-review` on a PR triggers the review. Reviewed By: zeyap Differential Revision: D117580751 Pulled By: Abbondanzo fbshipit-source-id: 9f6e5123b9d73d3f5cdf38c5f1fdabaec9a061c3