From b4735328013829a0404545e551f39fcd33985717 Mon Sep 17 00:00:00 2001 From: Jim Blanchard Date: Sat, 27 Jan 2024 11:20:25 -0800 Subject: [PATCH] fix: Default branch resolution when running E2E tests (#12910) --- .github/actions/setup-samples-staging/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-samples-staging/action.yml b/.github/actions/setup-samples-staging/action.yml index 508e36b4ed7..1ec60429095 100644 --- a/.github/actions/setup-samples-staging/action.yml +++ b/.github/actions/setup-samples-staging/action.yml @@ -34,13 +34,13 @@ runs: env: BRANCH: ${{ github.ref_name }} run: | - if git ls-remote origin $BRANCH | grep -q refs/heads/next/$BRANCH$; then - # Branch exists, checkout and echo success message + if git ls-remote --exit-code --heads origin refs/heads/$BRANCH; then + # Corresponding branch on sample repo exists, check it out git fetch origin $BRANCH git checkout $BRANCH echo "Checked out branch: $BRANCH" else - # Branch doesn't exist, echo error message + # Corresponding branch doesn't exist, default to main echo "Branch '$BRANCH' does not exist" fi