Skip to content

Commit 544b5f4

Browse files
Use the PR base branch to pick the template in template app workflows
On a pull request `github.ref_name` is `<number>/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 <donadeldev@gmail.com>
1 parent 64af229 commit 544b5f4

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎.github/workflows/build-android-templateapp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
# Stable branches use their matching template branch. All other
4949
# builds use the template's main branch.
50-
BRANCH=${{ github.ref_name }}
50+
BRANCH=${{ github.base_ref || github.ref_name }}
5151
if ! [[ $BRANCH == *-stable* ]]; then
5252
BRANCH=main
5353
fi

‎.github/workflows/build-ios-templateapp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
6868
# For stable branches, we want to use the stable branch of the template
6969
# In all the other cases, we want to use "main"
70-
BRANCH=${{ github.ref_name }}
70+
BRANCH=${{ github.base_ref || github.ref_name }}
7171
if ! [[ $BRANCH == *-stable* ]]; then
7272
BRANCH=main
7373
fi

‎.github/workflows/e2e-android-templateapp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
5252
# For stable branches, we want to use the stable branch of the template
5353
# In all the other cases, we want to use "main"
54-
BRANCH=${{ github.ref_name }}
54+
BRANCH=${{ github.base_ref || github.ref_name }}
5555
if ! [[ $BRANCH == *-stable* ]]; then
5656
BRANCH=main
5757
fi

‎.github/workflows/e2e-ios-templateapp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
9797
echo "React Native tgs is $REACT_NATIVE_PKG"
9898
99-
BRANCH=${{ github.ref_name }}
99+
BRANCH=${{ github.base_ref || github.ref_name }}
100100
if ! [[ $BRANCH == *-stable* ]]; then
101101
BRANCH=main
102102
fi

0 commit comments

Comments
 (0)