diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index 14839851cda..f4beb5aa0bd 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -220,6 +220,8 @@ jobs: VIDEO: ${{ needs.playwright-video-new-tests.result }} run: | [[ "$SHOULD_RUN" != "true" ]] && echo "E2E skipped" && exit 0 + echo "sharded=$SHARDED browsers=$BROWSERS video=$VIDEO" + [[ "$SHARDED" == "cancelled" || "$BROWSERS" == "cancelled" || "$VIDEO" == "cancelled" ]] && echo "E2E cancelled, not failed - rerun to get a result" && exit 1 [[ "$SHARDED" != "success" || "$BROWSERS" != "success" || ( "$VIDEO" != "success" && "$VIDEO" != "skipped" ) ]] && echo "E2E failed" && exit 1 echo "E2E passed" @@ -268,8 +270,16 @@ jobs: id: detect run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" - BASE_SHA="${{ github.event.pull_request.base.sha }}" - NEW_FILES=$(git diff --name-only --diff-filter=A "$BASE_SHA"...HEAD -- browser_tests/tests | grep '\.spec\.ts$' || true) + # HEAD is refs/pull/N/merge, so its first parent is the base tip the PR was merged + # onto. pull_request.base.sha is recorded when the PR opens and does not follow the + # base branch, so diffing against it attributes every spec the base gained since + # then to this PR. + if git rev-parse --verify --quiet HEAD^2 >/dev/null; then + BASE_SHA=$(git rev-parse HEAD^1) + else + BASE_SHA="${{ github.event.pull_request.base.sha }}" + fi + NEW_FILES=$(git diff --name-only --diff-filter=A "$BASE_SHA" HEAD -- browser_tests/tests | grep '\.spec\.ts$' || true) if [ -z "$NEW_FILES" ]; then echo "has-new-tests=false" >> "$GITHUB_OUTPUT"