From ea4012b474b6438dda5f80b7fa760eaf5cbadaeb Mon Sep 17 00:00:00 2001 From: devs-rootstrap <112487182+devs-rootstrap@users.noreply.github.com> Date: Fri, 6 Nov 2026 09:06:08 -0300 Subject: [PATCH 1/3] ci: open a pr to fix expo dependencies when expo doctor fails --- .github/workflows/expo-doctor.yml | 55 +++++++++++++++++++++++- docs/src/content/docs/ci-cd/overview.mdx | 2 +- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/.github/workflows/expo-doctor.yml b/.github/workflows/expo-doctor.yml index f202e8e5a..3929769da 100644 --- a/.github/workflows/expo-doctor.yml +++ b/.github/workflows/expo-doctor.yml @@ -3,8 +3,12 @@ # ✍️ Description: # This workflow runs the expo doctor command to check if your project dependencies are aligned with the expo sdk version you are using. -# Can be triggered manually from the Actions tab in your project. +# Can be triggered manually from the Actions tab in your project, and also runs once a week on a schedule. # Runs Also on pull requests and pushes to the main/master branch, but only if the `package.json` or `pnpm-lock.yaml` files have been changed. +# When expo doctor fails outside of a pull request (push, schedule or manual run), a second job runs `expo install --fix` +# on the default branch and opens (or updates) a pull request with the aligned dependencies, so they can be reviewed and merged. +# Note: pull requests opened with the default GITHUB_TOKEN do not trigger other workflows; close and reopen the pull request to run the checks. +# Note: "Allow GitHub Actions to create and approve pull requests" must be enabled in the repository settings (Settings > Actions > General). # 🚨 GITHUB SECRETS REQUIRED: NONE @@ -22,6 +26,9 @@ on: paths: - package.json - pnpm-lock.yaml + schedule: + - cron: '0 9 * * 1' # Every Monday at 09:00 UTC + workflow_dispatch: permissions: contents: read @@ -55,3 +62,49 @@ jobs: with: header: expo-doctor path: .expo/expo-doctor.md + + fix-dependencies: + name: Fix Expo dependencies (expo) + needs: doctor + if: always() && needs.doctor.result == 'failure' && github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: 📦 Checkout default branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} + + - name: 📦 Setup Node + PNPM + install deps + uses: ./.github/actions/setup-node-pnpm-install + + - name: 🔧 Align dependencies with the Expo SDK + run: pnpm expo install --fix + + - name: 🔀 Create or update Pull Request + uses: peter-evans/create-pull-request@v8 + with: + branch: chore/expo-doctor-fix-dependencies + delete-branch: true + add-paths: | + package.json + pnpm-lock.yaml + commit-message: 'chore: align dependencies with the expo sdk' + title: 'chore: align dependencies with the expo sdk' + body: | + ## What does this do? + + Runs `pnpm expo install --fix` on the default branch to update the dependencies that Expo Doctor reported as not aligned with the installed Expo SDK version. + + ## Why did you do this? + + The [Expo Doctor workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed, and this pull request was created automatically by it. + + ## How to review + + - Review the version changes in `package.json` and `pnpm-lock.yaml`. + - Checks are not triggered automatically for pull requests created by GitHub Actions: close and reopen this pull request to run them. + - Expo Doctor may also report issues that `expo install --fix` cannot solve; check the workflow logs and fix those manually. diff --git a/docs/src/content/docs/ci-cd/overview.mdx b/docs/src/content/docs/ci-cd/overview.mdx index 01bb83ece..1908370bd 100644 --- a/docs/src/content/docs/ci-cd/overview.mdx +++ b/docs/src/content/docs/ci-cd/overview.mdx @@ -16,7 +16,7 @@ As most of our projects are hosted on GitHub, we use [GitHub Actions](https://gi - `.github/workflows/test.yml`: On PR and new commits on the master branch, run unit tests. - `.github/workflows/type-check.yml`: On PR and new commits on the master branch, run type checking. - `.github/workflows/compress-images.yml`: On new commits to the master branch, when adding images, open a pull request (PR) with the compressed images. -- `.github/workflows/expo-doctor.yml`: On PR and new commits to the master branch, check whether dependencies are aligned with the Expo SDK version. +- `.github/workflows/expo-doctor.yml`: On PR, new commits to the master branch, a weekly schedule, and manual runs, check whether dependencies are aligned with the Expo SDK version. When the check fails outside of a PR, run `expo install --fix` and open a pull request (PR) with the aligned dependencies for review. - `.github/workflows/new-app-version.yml`: A workflow to manually trigger and update the app version, and publish a tag. You can check the full list of workflows [here](/ci-cd/workflows-references/) From 823be6731b3d4a697dca4b40b9bab1fc0a66d14a Mon Sep 17 00:00:00 2001 From: devs-rootstrap <112487182+devs-rootstrap@users.noreply.github.com> Date: Fri, 6 Nov 2026 09:07:03 -0300 Subject: [PATCH 2/3] ci: run the expo dependencies fix only on the default branch --- .github/workflows/expo-doctor.yml | 7 ++++--- docs/src/content/docs/ci-cd/overview.mdx | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/expo-doctor.yml b/.github/workflows/expo-doctor.yml index 3929769da..d0cd5a451 100644 --- a/.github/workflows/expo-doctor.yml +++ b/.github/workflows/expo-doctor.yml @@ -5,8 +5,8 @@ # This workflow runs the expo doctor command to check if your project dependencies are aligned with the expo sdk version you are using. # Can be triggered manually from the Actions tab in your project, and also runs once a week on a schedule. # Runs Also on pull requests and pushes to the main/master branch, but only if the `package.json` or `pnpm-lock.yaml` files have been changed. -# When expo doctor fails outside of a pull request (push, schedule or manual run), a second job runs `expo install --fix` -# on the default branch and opens (or updates) a pull request with the aligned dependencies, so they can be reviewed and merged. +# When expo doctor fails on the default branch outside of a pull request (push, schedule or manual run), a second job runs +# `expo install --fix` on the default branch and opens (or updates) a pull request with the aligned dependencies, so they can be reviewed and merged. # Note: pull requests opened with the default GITHUB_TOKEN do not trigger other workflows; close and reopen the pull request to run the checks. # Note: "Allow GitHub Actions to create and approve pull requests" must be enabled in the repository settings (Settings > Actions > General). @@ -66,7 +66,8 @@ jobs: fix-dependencies: name: Fix Expo dependencies (expo) needs: doctor - if: always() && needs.doctor.result == 'failure' && github.event_name != 'pull_request' + # Only for runs on the default branch, so the fix is applied to the same code that was checked + if: always() && needs.doctor.result == 'failure' && github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch runs-on: ubuntu-latest permissions: contents: write diff --git a/docs/src/content/docs/ci-cd/overview.mdx b/docs/src/content/docs/ci-cd/overview.mdx index 1908370bd..3e3e73cb2 100644 --- a/docs/src/content/docs/ci-cd/overview.mdx +++ b/docs/src/content/docs/ci-cd/overview.mdx @@ -16,7 +16,7 @@ As most of our projects are hosted on GitHub, we use [GitHub Actions](https://gi - `.github/workflows/test.yml`: On PR and new commits on the master branch, run unit tests. - `.github/workflows/type-check.yml`: On PR and new commits on the master branch, run type checking. - `.github/workflows/compress-images.yml`: On new commits to the master branch, when adding images, open a pull request (PR) with the compressed images. -- `.github/workflows/expo-doctor.yml`: On PR, new commits to the master branch, a weekly schedule, and manual runs, check whether dependencies are aligned with the Expo SDK version. When the check fails outside of a PR, run `expo install --fix` and open a pull request (PR) with the aligned dependencies for review. +- `.github/workflows/expo-doctor.yml`: On PR, new commits to the master branch, a weekly schedule, and manual runs, check whether dependencies are aligned with the Expo SDK version. When the check fails on the master branch outside of a PR, run `expo install --fix` and open a pull request (PR) with the aligned dependencies for review. - `.github/workflows/new-app-version.yml`: A workflow to manually trigger and update the app version, and publish a tag. You can check the full list of workflows [here](/ci-cd/workflows-references/) From 497cd3e0fdceb78f7f8363c3b40f18ac3a9edae8 Mon Sep 17 00:00:00 2001 From: devs-rootstrap <112487182+devs-rootstrap@users.noreply.github.com> Date: Fri, 6 Nov 2026 09:07:58 -0300 Subject: [PATCH 3/3] ci: pin the create-pull-request action to a commit sha --- .github/workflows/expo-doctor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/expo-doctor.yml b/.github/workflows/expo-doctor.yml index d0cd5a451..ec02e5e12 100644 --- a/.github/workflows/expo-doctor.yml +++ b/.github/workflows/expo-doctor.yml @@ -66,7 +66,8 @@ jobs: fix-dependencies: name: Fix Expo dependencies (expo) needs: doctor - # Only for runs on the default branch, so the fix is applied to the same code that was checked + # Only for runs on the default branch. The fix is applied to the latest commit of the default branch, + # which may be newer than the commit checked by the doctor job. if: always() && needs.doctor.result == 'failure' && github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch runs-on: ubuntu-latest permissions: @@ -86,7 +87,7 @@ jobs: run: pnpm expo install --fix - name: 🔀 Create or update Pull Request - uses: peter-evans/create-pull-request@v8 + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 with: branch: chore/expo-doctor-fix-dependencies delete-branch: true