diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index b9d3ae5548e..a0d7ea07b99 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -287,12 +287,16 @@ jobs: # 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)" == "${{ github.event.pull_request.head.sha }}" ]]; then + if [ "$(git rev-parse --verify --quiet HEAD^2)" = "${{ github.event.pull_request.head.sha }}" ]; then DIFF_RANGE="$(git rev-parse HEAD^1)..HEAD" else DIFF_RANGE="${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}" fi - NEW_FILES=$(git diff --name-only --diff-filter=A "$DIFF_RANGE" -- browser_tests/tests | grep '\.spec\.ts$' || true) + # git diff and grep are separate statements (not piped) so a git diff failure + # (e.g. the fallback sha isn't in the local object store) surfaces as a build + # error instead of silently reading as "no new specs" and no-oping the video job. + ADDED_FILES=$(git diff --name-only --diff-filter=A "$DIFF_RANGE" -- browser_tests/tests) + NEW_FILES=$(printf '%s\n' "$ADDED_FILES" | grep '\.spec\.ts$' || true) if [ -z "$NEW_FILES" ]; then echo "has-new-tests=false" >> "$GITHUB_OUTPUT"