Playwright testing with GitHub Actions: bonus - additional quality gates for your PRs
A companion to the previous article: simple, reusable quality gates that keep your main branch clean and green with minimal effort.
In the previous article, we turned a simple smoke test workflow into a required check — the first small step toward workflow orchestration.
As a follow-up, here’s a practical addition you can plug directly into your repository: a centralized workflow that gathers several essential checks into one place.
It verifies that the project compiles correctly, ensures formatting and linting are consistent, and checks that any newly added or changed tests pass before they reach main.
No deep dive this time — just a ready-to-use workflow built on top of the reusable components from earlier in the series.
Setup Project (Composite Action)
This new composite action provides a lightweight setup step for workflows that don’t require the full Playwright environment. Unlike the Playwright setup action, it skips browser installation and focuses only on what ESLint, Prettier, and the TypeScript compiler need: Node.js and project dependencies. It keeps these checks fast, clean, and independent from the heavier test infrastructure.
Compile Check
This workflow ensures the project can compile cleanly by running TypeScript with --noEmit. It catches missing types, broken imports, and structural issues before they ever reach main. A quick, dependable signal that the codebase remains type-safe.
ESLint Check
This workflow runs ESLint across the repository to enforce consistent code quality and prevent common errors. It uses the shared project setup and produces fast feedback on any violations introduced in the PR.
Prettier Check
This workflow verifies formatting using Prettier’s --check mode, ensuring that all code entering main follows the same standard. It keeps diffs clean and removes formatting noise from review.
New or Changed Tests Check
This workflow looks for newly added or modified tests in the PR and runs only those tests across all Playwright projects. If anything fails, the PR is blocked, guaranteeing that no broken tests are introduced into the main branch. It’s a small but powerful safeguard for test hygiene.
This workflow focuses on a single task: running only the tests that were added or changed in a pull request. To do that, it compares the current PR against a base branch — main by default — and uses git diff to identify which test files have actually been modified. Because this comparison requires a full commit history, the checkout step uses fetch-depth: 0, ensuring Git has enough information to calculate the diff correctly.
Once the changed files are identified, the workflow checks whether each test is relevant to the project, utilizing Playwright’s capability to list tests with the appropriate tags and configurations. Only if a test applies to that specific project is it actually executed.
PR Checks Orchestrator
This workflow ties everything together. Instead of scattering checks across multiple files, it centralizes compilation, linting, formatting, and new-test verification into one coordinated quality gate. With concurrency control and a single entry point, it becomes an easy and predictable required check for PRs.
Having these checks in place is important for one simple reason: they protect the long-term health of the codebase — automatically, consistently, and without relying on humans to catch every issue in reviews.






