Pre-flight Checks
Problem Description
The millionco/react-doctor@v1.1.1 GitHub Action was failing in CI with sh: 1: react-doctor: not found, even though the action had previously worked. We replaced it with a direct bunx react-doctor invocation, but we should understand and document the root cause before closing the loop.
Investigation Summary
Action version: millionco/react-doctor@v1.1.1 with version: '0.2.16'
The action installs its own copy of react-doctor via npm into a cached toolchain directory. The flow is:
actions/cache restores the toolchain from a previous run
- If
$TOOLCHAIN_DIR/node_modules/.bin/react-doctor exists and is executable → skip install
- Run the cached binary
Hypothesized root cause: A stale/corrupt actions/cache entry. If a previous npm install was partial or the cached binary became invalid (runner image change, Node version mismatch, ABI incompatibility), the cache hit would restore a broken binary. The action's existence check ([ -x "$TOOLCHAIN_DIR/node_modules/.bin/react-doctor" ]) passes, but the binary fails at execution time.
Migration to bunx:
We replaced the action with a direct bun command that is simpler and more reliable:
- name: Fetch base branch for diff scan
if: github.event_name == 'pull_request'
run: git fetch --no-tags --depth=1 origin ${{ github.event.pull_request.base.ref }}
- name: React Doctor (diff scan)
working-directory: apps/mobile
run: |
git switch --create ci-branch
bunx react-doctor --verbose --diff --fail-on error
- name: React Doctor (full scan — informational)
working-directory: apps/mobile
run: bunx react-doctor --verbose || true
Key learnings about react-doctor CLI flags (v0.2.16):
| Flag |
Supported |
Notes |
--verbose |
✅ |
|
--diff |
✅ |
Requires a feature branch (not detached HEAD) + origin/main available |
--fail-on error |
✅ |
Fails CI on errors only |
--scope changed |
❌ |
Action-only input, not a direct CLI flag in v0.2.16 |
--blocking error |
❌ |
Action-only input, not a direct CLI flag in v0.2.16 |
--changed-files-from |
❓ |
Possibly supported but not tested |
PR merge ref issue:
CI checks out refs/pull/N/merge which creates a detached HEAD. React Doctor's --diff uses git rev-parse --abbrev-ref HEAD to detect the feature branch. On detached HEAD, it falls back to full scan. Fix: git switch --create ci-branch before running.
Proposed Solution
Revisit using the official action when:
- The action is updated to v2.x (
v2.2.2 is latest)
- Confirm v2 fixes the stale cache issue (or the cache key has changed)
- Document if v2's CLI flags match what we currently use
- The action provides additional value we're missing: PR comments, inline review comments, commit status, changed-file detection
Affected Area
CI/Workflows
Alternatives Considered
Current approach with direct bunx works reliably. The action would add PR comment/status integration.
Pre-flight Checks
Problem Description
The
millionco/react-doctor@v1.1.1GitHub Action was failing in CI withsh: 1: react-doctor: not found, even though the action had previously worked. We replaced it with a directbunx react-doctorinvocation, but we should understand and document the root cause before closing the loop.Investigation Summary
Action version:
millionco/react-doctor@v1.1.1withversion: '0.2.16'The action installs its own copy of react-doctor via npm into a cached toolchain directory. The flow is:
actions/cacherestores the toolchain from a previous run$TOOLCHAIN_DIR/node_modules/.bin/react-doctorexists and is executable → skip installHypothesized root cause: A stale/corrupt
actions/cacheentry. If a previous npm install was partial or the cached binary became invalid (runner image change, Node version mismatch, ABI incompatibility), the cache hit would restore a broken binary. The action's existence check ([ -x "$TOOLCHAIN_DIR/node_modules/.bin/react-doctor" ]) passes, but the binary fails at execution time.Migration to bunx:
We replaced the action with a direct bun command that is simpler and more reliable:
Key learnings about react-doctor CLI flags (v0.2.16):
--verbose--difforigin/mainavailable--fail-on error--scope changed--blocking error--changed-files-fromPR merge ref issue:
CI checks out
refs/pull/N/mergewhich creates a detached HEAD. React Doctor's--diffusesgit rev-parse --abbrev-ref HEADto detect the feature branch. On detached HEAD, it falls back to full scan. Fix:git switch --create ci-branchbefore running.Proposed Solution
Revisit using the official action when:
v2.2.2is latest)Affected Area
CI/Workflows
Alternatives Considered
Current approach with direct bunx works reliably. The action would add PR comment/status integration.