# React Doctor — finds security, performance, correctness, accessibility, # bundle-size, and architecture issues in React codebases. # # Docs: https://www.react.doctor/ci # Source: https://github.com/millionco/react-doctor name: React Doctor on: pull_request: types: [opened, synchronize, reopened, ready_for_review] # Scans `main` on every push so you get a health-score trend on the # default branch — useful for tracking the overall number commit-by-commit # and catching regressions that slipped past PR review. PR-specific steps # (the sticky summary comment) are skipped automatically on `push` events. # Comment this block out if you only want PR-time scans. push: branches: [main] # Least privilege: nothing by default; the job below gets only what it uses. permissions: {} # Cancels any in-flight scan for the same PR (or branch, on push) the moment # a new commit arrives, so reviewers only ever see the latest run. concurrency: group: react-doctor-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: react-doctor: runs-on: ubuntu-latest permissions: # `actions/checkout` needs this to read the repo source. contents: read # Reads the PR's changed-file list (scan scoped to the diff), and posts the # sticky summary comment + inline review comments. `pull-requests: write` # also covers the `issues.*Comment` endpoints when the issue is a PR, so # `issues: write` is not needed. pull-requests: write # Commit status with the score + counts — how a `push` to `main` surfaces # its result, since the PR comment is skipped off pull requests. statuses: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - uses: millionco/react-doctor@695e46eee203a5d1855020191aa7e9c010a1250e # v2.4.0 with: # Pinned instead of the action's default "latest" (fetched from npm at # runtime). Keep in sync with the `react-doctor` version pnpm-lock.yaml # resolves for the root devDependency, so CI scans with the same # version `pnpm exec react-doctor` runs locally. version: "0.9.4" # Other knobs — full reference: https://www.react.doctor/ci # blocking: warning # Gate level: "error" (default) | "warning" | "none" (advisory) # scope: full # On PRs, scan the whole project instead of just changed files # comment: false # Disable the sticky PR summary comment # review-comments: false # Disable inline review comments on changed lines # commit-status: false # Disable the commit status (then drop `statuses: write`) # directory: apps/web # Scan a sub-directory (default: ".") # project: "web,admin" # In a monorepo, scan specific workspace project(s)