Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci-tests-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading