Fail CI on a slip
Fail a pull request’s checks when its change slips or breaks a scenario.
Add the job
Section titled “Add the job”The following workflow compares the pull request’s head with main. It fetches every branch, so origin/main is
there to check out as the base, and it stops whatever Rehearse left up, even after a failure.
name: Rehearse
on: pull_request
jobs: compare: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: pnpm/action-setup@v4 - uses: actions/setup-node@v5 with: node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm exec rehearse compare --base origin/main - if: always() run: pnpm exec rehearse down --allIt needs Rehearse as a dev dependency, as Get started installs it. A repository with piece or flow
scenarios also runs pnpm exec playwright-core install --with-deps chromium before the comparison.
What it does
Section titled “What it does”rehearse compare exits 1 unless both sides came up, every scenario ran, and nothing fails on the head or changed
without saying so. On the tutorial’s branch, the step fails and its log reads as follows.
$ pnpm exec rehearse compare --base origin/main0 as on the base · 1 changed without saying so
changed without saying so: The greeting says hello (greeting.hurl:2) $.text: "Hello" → "Hello, friend"
unannounced, by what changed: $.text — in 1 scenario
1 id, time or opaque value was set aside before comparing.To let a scenario that also fails on main through, or to send the author more than the text, gate on the JSON
instead, as Use Rehearse at a gate does.