Skip to content

ci: run only changed e2e tests on PRs - #292

Merged
h4yfans merged 1 commit into
mainfrom
ci/e2e-pr-changed-only
Apr 20, 2026
Merged

ci: run only changed e2e tests on PRs#292
h4yfans merged 1 commit into
mainfrom
ci/e2e-pr-changed-only

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Splits the e2e workflow into two jobs based on event type:

  • e2e-changed (PRs only) — resolves changed *.e2e.ts files against ${{ github.event.pull_request.base.sha }} (handles rebases and stacked PRs correctly), passes them as positional args to Playwright, and short-circuits every step when no e2e files changed. The job still appears in the Checks UI as ✅ for branch-protection compatibility.
  • e2e (push to main + workflow_dispatch) — unchanged, full sharded suite [1/3, 2/3, 3/3]. Still the safety net post-merge.

The trigger now also includes pull_request, which the existing workflow lacked entirely.

Why this is safer than it sounds

Changed-only catches bugs in the new test itself but misses regressions where a source change breaks an unchanged e2e test. The full suite still runs on every push to main, so any regression that slips through PR review surfaces immediately post-merge instead of accumulating.

⚠️ Before merging — verify branch protection

The PR check name changes:

  • Before: Playwright Electron E2E (1/3) / (2/3) / (3/3) — these never appeared on PRs anyway since the workflow had no pull_request trigger.
  • After: Playwright E2E (changed only) on PRs.

If branch protection on main requires the old shard-named checks as PR gates, those rules need to be updated to require Playwright E2E (changed only) instead, or the rule will block all future PRs. Check repo Settings → Branches → main → Required status checks.

Implementation notes

  • Uses fetch-depth: 0 on checkout — the default shallow clone doesn't have the PR base commit, so git diff $BASE_SHA...HEAD would silently return empty and skip every PR.
  • --diff-filter=AMR covers Added + Modified + Renamed; deleted tests are correctly excluded.
  • Helper-style files like note-sync-helpers.e2e.ts and shared-sync-bootstrap.e2e.ts match the glob — editing them will trigger a run on a non-spec file. Pre-existing naming quirk; rename to *.helper.ts later if it becomes noisy.
  • Args are passed via env var (E2E_FILES) into the inner dbus-run-session bash -c '...' instead of GitHub Actions string interpolation — safer against any odd characters in filenames.

Test plan

  • Open a no-op PR (e.g. README typo) — confirm e2e-changed job runs, resolves zero files, and finishes in ~30s green
  • Edit one e2e file in a PR — confirm e2e-changed runs only that file
  • Confirm push-to-main still triggers the full 3-shard suite

🤖 Generated with Claude Code

PRs trigger a new e2e-changed job that resolves changed *.e2e.ts files
against the PR base SHA and passes them as positional args to Playwright.
If no e2e files changed, every step short-circuits, leaving a passing
check entry for branch-protection compatibility.

The existing sharded full-suite job is gated to push-to-main and manual
dispatch only, so we keep the safety net post-merge.
@h4yfans
h4yfans merged commit e3fe9d4 into main Apr 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant