Skip to content

Commit 15cf159

Browse files
authored
Merge pull request #6352 from NHSDigital/refine-e2e-branch-selection
Check for base branch in testing repo when selecting test branch
2 parents 449e402 + d785206 commit 15cf159

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/end-to-end-tests-on-pull-request.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,23 @@ jobs:
343343
outputs:
344344
test_branch: ${{ steps.check-branch.outputs.test_branch }}
345345
steps:
346-
- name: Check if branch exists
346+
- name: Check if head branch or base branch exists
347347
id: check-branch
348348
run: |
349349
if git ls-remote --exit-code \
350350
--heads https://github.com/NHSDigital/manage-vaccinations-in-schools-testing.git \
351-
"$BRANCH_TO_CHECK" > /dev/null 2>&1; then
352-
echo "test_branch=$BRANCH_TO_CHECK" >> "$GITHUB_OUTPUT"
351+
"$HEAD_REF" > /dev/null 2>&1; then
352+
echo "test_branch=$HEAD_REF" >> "$GITHUB_OUTPUT"
353+
elif git ls-remote --exit-code \
354+
--heads https://github.com/NHSDigital/manage-vaccinations-in-schools-testing.git \
355+
"$BASE_REF" > /dev/null 2>&1; then
356+
echo "test_branch=$BASE_REF" >> "$GITHUB_OUTPUT"
353357
else
354358
echo "test_branch=main" >> "$GITHUB_OUTPUT"
355359
fi
356360
env:
357-
BRANCH_TO_CHECK: ${{ github.head_ref }}
361+
HEAD_REF: ${{ github.head_ref }}
362+
BASE_REF: ${{ github.base_ref }}
358363
call-end-to-end-tests:
359364
needs: [launch-dockerized-devimage, wait-for-task-stability, find-correct-test-branch]
360365
if:

0 commit comments

Comments
 (0)