From c47fa0050e7f3cb561a2a28e4eebacb7e09bd830 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Date: Fri, 4 Dec 2026 14:45:07 -0300 Subject: [PATCH] Use the PR base branch to pick the template in template app workflows On a pull request `github.ref_name` is `/merge`, which has no `-stable` in it, so the template app workflows fall back to the template's `main` branch even when the PR targets a stable branch. On main that is harmless, since `main` is the right template there. But every stable branch is cut from main with these files, and its PRs then build and test against template `main` instead of the matching stable template. On 0.88-stable this breaks every PR: template `main` pins @react-native-community/cli 22.0.0-alpha.0, which no longer exports `createDevServerMiddleware`, so Metro exits with "createCommunityMiddleware is not a function" and test_e2e_{ios,android}_templateapp fail in all three attempts, while pushes to the branch pass. Use `github.base_ref` when it is set, as 0.89-stable already does in its iOS template workflows. Pushes are unchanged, since `base_ref` is empty there. Signed-off-by: Gabriel Donadel --- .github/workflows/build-android-templateapp.yml | 2 +- .github/workflows/build-ios-templateapp.yml | 2 +- .github/workflows/e2e-android-templateapp.yml | 2 +- .github/workflows/e2e-ios-templateapp.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-android-templateapp.yml b/.github/workflows/build-android-templateapp.yml index af879834bd2e..6d761ed6ee5e 100644 --- a/.github/workflows/build-android-templateapp.yml +++ b/.github/workflows/build-android-templateapp.yml @@ -47,7 +47,7 @@ jobs: # Stable branches use their matching template branch. All other # builds use the template's main branch. - BRANCH=${{ github.ref_name }} + BRANCH=${{ github.base_ref || github.ref_name }} if ! [[ $BRANCH == *-stable* ]]; then BRANCH=main fi diff --git a/.github/workflows/build-ios-templateapp.yml b/.github/workflows/build-ios-templateapp.yml index 8285dc22af5f..5edf802b1448 100644 --- a/.github/workflows/build-ios-templateapp.yml +++ b/.github/workflows/build-ios-templateapp.yml @@ -67,7 +67,7 @@ jobs: # For stable branches, we want to use the stable branch of the template # In all the other cases, we want to use "main" - BRANCH=${{ github.ref_name }} + BRANCH=${{ github.base_ref || github.ref_name }} if ! [[ $BRANCH == *-stable* ]]; then BRANCH=main fi diff --git a/.github/workflows/e2e-android-templateapp.yml b/.github/workflows/e2e-android-templateapp.yml index f3dfcc17181e..1eb9dca26108 100644 --- a/.github/workflows/e2e-android-templateapp.yml +++ b/.github/workflows/e2e-android-templateapp.yml @@ -51,7 +51,7 @@ jobs: # For stable branches, we want to use the stable branch of the template # In all the other cases, we want to use "main" - BRANCH=${{ github.ref_name }} + BRANCH=${{ github.base_ref || github.ref_name }} if ! [[ $BRANCH == *-stable* ]]; then BRANCH=main fi diff --git a/.github/workflows/e2e-ios-templateapp.yml b/.github/workflows/e2e-ios-templateapp.yml index 6559042828f4..fd94134e41e9 100644 --- a/.github/workflows/e2e-ios-templateapp.yml +++ b/.github/workflows/e2e-ios-templateapp.yml @@ -96,7 +96,7 @@ jobs: REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz") echo "React Native tgs is $REACT_NATIVE_PKG" - BRANCH=${{ github.ref_name }} + BRANCH=${{ github.base_ref || github.ref_name }} if ! [[ $BRANCH == *-stable* ]]; then BRANCH=main fi