Skip to content

ci: open a pr to fix expo dependencies when expo doctor fails - #167

Open
devs-rootstrap wants to merge 3 commits into
masterfrom
chore/expo-doctor-auto-fix-pr
Open

devs-rootstrap wants to merge 3 commits into
masterfrom
chore/expo-doctor-auto-fix-pr

Conversation

@devs-rootstrap

Copy link
Copy Markdown
Collaborator

Jira board reference:


What does this do?

Extends .github/workflows/expo-doctor.yml so that outdated Expo SDK dependencies are fixed automatically and proposed as a pull request:

  • Adds a weekly schedule trigger (Mondays at 09:00 UTC) and a workflow_dispatch trigger (the workflow header already said it could be run manually, but the trigger was missing).
  • Adds a fix-dependencies job that needs: doctor and only runs when:
    • the doctor job failed,
    • the event is not pull_request (push to main/master, schedule or manual run),
    • the run is on the default branch.
  • The job checks out the default branch, installs dependencies with the existing setup-node-pnpm-install action, runs pnpm expo install --fix (the non-interactive equivalent of npx expo install --check) and, if package.json / pnpm-lock.yaml changed, uses peter-evans/create-pull-request (v8.1.1, pinned to its commit SHA) to open or update a single PR from the fixed branch chore/expo-doctor-fix-dependencies, titled chore: align dependencies with the expo sdk, with a body linking to the failing run and explaining how to review it.
  • Write permissions (contents: write, pull-requests: write) are granted only to the new job; the doctor job keeps its current permissions. It uses the default GITHUB_TOKEN, so no new secrets are required.
  • Updates the workflow header comment and the CI/CD overview page in the docs.

Why did you do this?

Expo Doctor frequently fails because Expo dependencies fall behind the installed SDK patch versions. The fix is almost always the same manual routine: run npx expo install --check, commit the result and open a PR. This automates that routine so the fix PR is ready for review as soon as the problem is detected, either after a push to the default branch or by the weekly scheduled check.

Who/what does this impact?

  • Only the Expo Doctor workflow; the doctor check on pull requests behaves as before (report comment, no auto-fix).
  • Projects generated from the template inherit this workflow (the CLI does not remove or edit expo-doctor.yml), so they also get the weekly check and the auto-fix PR. No CLI changes were needed.

Assumptions / requirements:

  • "Allow GitHub Actions to create and approve pull requests" must be enabled in the repository settings (Settings > Actions > General) for the PR to be created. Generated projects need the same setting.
  • PRs opened with the default GITHUB_TOKEN do not trigger other workflows, so CI checks on the auto-generated PR have to be started by closing and reopening it (or by pushing to it). Using a PAT or GitHub App token to avoid this is out of scope.
  • expo install --fix only fixes dependency version alignment. If Expo Doctor fails for other reasons, no changes are produced and no PR is opened; those issues still need manual fixes.
  • The fix runs on the latest commit of the default branch at the time the job starts.

Layer 2: Risk Classification

Author applies a risk label when opening the PR. When in doubt, escalate.

Label When to use
risk:low Config, copy, minor UI tweaks. Low blast radius.
risk:medium Feature work, refactors touching multiple files.
risk:high Auth, payments, migrations, security-sensitive code.

Setup

  • Create risk:low, risk:medium, risk:high labels in the repo
  • Add risk criteria to contributing guide or PR template
  • Add reminder in PR template to apply the label before requesting review
  • Define who can override/escalate (suggested: tech lead)

How did you test this?

  • Tested on iOS
  • Tested on Android
  • Tested on a small device
  • Tested on a real device
  • Tested all flows related with this PR changes
  • Tested accessibility
  • Added tests

Verification

  • The workflow file parses as valid YAML (checked with the yaml package); actionlint was not available in the environment.
  • CI=1 pnpm expo install --check on current master reports outdated packages (expo, expo-constants, expo-font, expo-localization, expo-router, jest-expo), so the doctor job is expected to fail and the new job to open a PR.
  • CI=1 pnpm expo install --fix was run locally on master: it completed without prompts and only modified package.json and pnpm-lock.yaml (changes discarded afterwards, not part of this PR).
  • pnpm lint, pnpm type-check, pnpm lint:translations and pnpm test (28 suites, 139 tests) pass.
  • The workflow itself has not been executed on GitHub Actions yet. Because the fix job only runs on the default branch, the recommended check is to trigger it manually after merging (Actions > Expo Doctor (expo) > Run workflow on master) and confirm that a PR from chore/expo-doctor-fix-dependencies is opened.

How to test locally

pnpm install --frozen-lockfile
CI=1 pnpm expo install --check   # lists outdated Expo packages
CI=1 pnpm expo install --fix     # updates package.json and pnpm-lock.yaml
git diff --stat                  # only package.json and pnpm-lock.yaml should change
git checkout -- package.json pnpm-lock.yaml && pnpm install --frozen-lockfile

Notes:

  • peter-evans/create-pull-request is pinned to a commit SHA (with the version in a comment) because it runs in a job with write permissions right after dependency install scripts.
  • Repeated failures update the same PR instead of opening new ones; the branch is deleted automatically if the default branch no longer needs changes.

Screenshots / Previews

Not applicable (CI workflow change).

@devs-rootstrap
devs-rootstrap requested a review from a team as a code owner November 6, 2026 12:08
@devs-rootstrap
devs-rootstrap requested review from amaury901130, asdolo and fernandatoledo and a balanced review from Copilot November 6, 2026 12:08
@devs-rootstrap devs-rootstrap added the risk:medium Feature work, refactors touching multiple files. label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

💯 Test Coverage

Lines Statements Branches Functions
Coverage: 56%
56.23% (347/617) 59.18% (174/294) 48.76% (118/242)

😎 Tests Results

Tests Skipped Failures Errors Time
139 0 💤 0 ❌ 0 🔥 35.999s ⏱️
👀 Tests Details • (56%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files56.2359.1848.7656.9 
report-only-changed-files is enabled. No files were changed in this commit :)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The failure-only guard prevents cleanup after dependencies are aligned, potentially leaving a generated branch or obsolete PR behind because delete-branch: true only takes effect when the action runs again.

1 open issue
What changed in this PR

Overall Review: ai:minor

Extends the template’s Expo Doctor workflow to propose dependency-alignment fixes automatically, reducing manual maintenance.

Changes:

  • Adds weekly scheduled checks and manual execution.
  • Adds a default-branch repair job that opens or updates a single dependency-fix PR after Doctor fails.
  • Documents the automation, required repository setting, and manual CI-trigger limitation.
File Description
docs/​src/​content/​docs/​ci-cd/​overview.mdx Documents scheduled checks and automatic dependency-fix PRs.
.github/​workflows/​expo-doctor.yml Adds triggers, the repair job, scoped write permissions, and PR review instructions.

Review effort: Balanced

Comment thread .github/workflows/expo-doctor.yml Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium Feature work, refactors touching multiple files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants