← all posts
ci·Lukas Babaliauskas·Jul 24, 2026·updated Nov 17, 2026·14 min read

LLM regression testing in CI: gate pull requests on eval diffs

Wire a golden suite into GitHub Actions so every pull request gets a paired eval run, a base-branch diff, and a check that fails on real regressions.

To regression-test an LLM application in CI, run a fixed golden suite on every pull request that touches a prompt, a model name or the suite itself, compare the run with one from the base branch, and fail the check only when the result crosses a threshold you wrote down in advance. Ship the check in report-only mode for about a week first, so you learn how noisy your suite is before that noise can block a merge.

An eval suite you run when you remember to run it is not a gate. It is a habit, and habits fail exactly when the pressure is on — the Friday prompt tweak, the dependency bump that moves a model alias, the week everyone is shipping something else. The suite stays correct the entire time. Nobody runs it.

The version that changes outcomes is attached to the pull request. Someone edits a system prompt to fix one customer complaint, the paired run says tool selection dropped on the refund slice, the check goes red, and the branch does not merge until someone looks. The conversation on the PR is then about a measured delta rather than about whether the change felt risky. This post covers what the gate has to answer, the four steps to wire it into GitHub Actions, and how to turn it on without halting your team's merges on day one.

A disclosure: I build EvalShift, which ships a GitHub Action for exactly this. It has a short section at the end. Everything before it works with whatever eval runner you already have.

What should a CI eval gate answer?

Three questions, on every pull request, with no human in the loop: did anything regress, where, and is it big enough to block. The first two are measurements; the third is a policy you write once.

QuestionWhat answers itMeasurement or policy?
Did anything regress?Cases that pass on the base branch and fail on this branchMeasurement
Where?The pass-rate change per slice: per route, language or customer tierMeasurement
Is it big enough to block?Budgets written down before the run, such as a maximum drop per slicePolicy

The slice breakdown is what turns "worse overall" into "worse on the multilingual cases, flat everywhere else", which is the sentence a reviewer can act on. The budgets are what stop every pull request from turning into a debate about whether a two-point drop matters.

The gate has to run on changes you did not make, too. Chen, Zaharia and Zou measured ↗ GPT-4 at 84% accuracy on identifying prime vs. composite numbers in March 2023 and 51% on the same questions in June 2023, under the same model name. Providers also reroute retired names: Google's changelog ↗ records that from October 8, 2026, API requests to gemini-3.5-flash are automatically routed to gemini-3.6-flash. A config bump that changes which model answers belongs behind the same gate as a prompt edit, and prompt regression testing covers the prompt edits themselves.

Step 1: commit the suite, the config and the secrets

The gate needs three things in the repository before the first run: the golden suite, the config that names the models and prompts, and a provider key stored as a secret. Without any of them the job fails or, worse, passes for the wrong reason.

Commit the suite as data — a JSONL file of real cases is enough — next to the config, so a change to either shows up in the same diff as the prompt change it tests. Store the model provider key as a repository or environment secret, never in the config. A cross-provider migration needs a key for each provider.

+

Every run makes real model calls and spends real credits. Cost per run is roughly suite size × 2 models (base and candidate) × prompts, minus cache hits — and a fresh runner starts with a cold cache, so in practice assume no reuse across CI runs unless you cache the baseline's results yourself.

That cost is the reason to scope the trigger. Narrowing on.pull_request.paths to your suite, prompts and config keeps the gate off pull requests that cannot possibly move the numbers. GitHub documents one edge ↗: if the generated diff contains more than 3,000 files and the matching files are not among the first 3,000, the workflow will not run, so a huge refactor can skip the gate silently.

Pull requests from forks are the other thing to decide now. GitHub's events reference ↗ says that, apart from GITHUB_TOKEN, secrets are not passed to the runner for a workflow triggered from a forked repository, and that GITHUB_TOKEN is read-only there. Skip the eval job on fork pull requests and run it after a maintainer pushes the branch; the workaround, pull_request_target, runs with secrets in scope, and the same page warns that running untrusted code on it "may lead to security vulnerabilities."

Step 2: add the workflow

The workflow is one job on pull_request: check out, run the suite, compare with the base branch, report, and exit non-zero when the policy says so. Add a concurrency group and a timeout, because the defaults are wrong for a job that spends money.

yaml
name: llm-regression
on:
  pull_request:
    paths: ["prompts/**", "evals/**", "llm-config.yaml"]
permissions:
  contents: read
  pull-requests: write   # for the PR comment
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true
jobs:
  eval:
    # Fork PRs get no secrets; skip rather than fail.
    if: github.event.pull_request.head.repo.full_name == github.repository
    runs-on: ubuntu-latest
    timeout-minutes: 30
    env:
      ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    steps:
      - uses: actions/checkout@v7
      - run: ./scripts/eval-gate.sh   # run, diff against the base branch, exit 1 to block

Each of those lines answers a default that bites an eval job:

SettingGitHub's defaultWhy an eval job changes it
timeout-minutes360 minutes ↗, within a 6-hour ↗ job limit on hosted runnersA provider outage should cost minutes, not six hours of a stuck job
concurrencyNo group, so every push starts its own runIn a group at most one ↗ run waits, and cancel-in-progress stops the stale one: three quick pushes pay for one run
if: on fork PRsThe job runs with no secrets and fails on the missing keyA skipped job reports success and does not block the PR
paths:Every pull request triggers the workflowOnly changes that can move the numbers spend credits

One trap if you make the gate a required check. GitHub's troubleshooting page ↗ says a workflow skipped by path filtering leaves its checks in a "Pending" state that blocks merging, while a job skipped by a conditional reports "Success". So either leave the eval check optional, or drop paths: and skip the eval job with a job-level if: fed by an earlier job that lists the changed files.

Report in two places. A single PR comment, edited in place on each push, carries the verdict and the worst slices; the job summary carries the full table. GitHub caps ↗ each step's summary at 1 MiB and displays at most 20 step summaries per job, which is plenty for a results table but not for raw transcripts.

Step 3: choose what fails the build

Block on a verdict against budgets you wrote down, not on any movement at all. Every gate rule reads one of three things, and each is blind to something different.

Gate ruleReadsFails whenBlind spot
Policy verdictThis run's own paired statisticsA written budget is exceededBudgets you never wrote
Any regressionThe diff against the base-branch runOne or more cases regressedNo base run yet means nothing to diff
Any slice regressionPer-slice pass-rate deltasAny slice's pass rate went downSmall slices that never reach significance

The non-obvious part: "any slice regression" is not a stricter "any regression". They read different fields. A run with regressed cases but no slice whose pass rate dropped fails the second rule and passes the third, so switching rules is a change of question, not a tightening of a dial.

The other case to have in your head is the empty one. With no comparable run on the base branch — a new project, or a renamed branch — a diff-based rule has nothing to compare, counts zero regressions, and passes. A permanently green check under those rules usually means this, not that your suite is passing. A policy verdict does not depend on a baseline: it judges the run it was given, comparing the current and candidate setups on the same cases inside that run.

That pairing is also what keeps the gate from flapping. Miller's "Adding Error Bars to Evals" ↗ works an example where model scores correlate at 0.5 and paired differences reduce the variance of the estimator by 1/3, which is why comparing both models case by case beats comparing two pass rates. You still need repeats: Atil et al. ran ↗ five LLMs configured to be deterministic over eight tasks, 10 runs each, and saw accuracy vary by up to 15% between runs, with a gap of up to 70% between the best and worst possible performance.

Step 4: roll it out without blocking everyone on day one

Turn the gate on in three stages: report only, then block on the policy verdict, then add per-slice blocking once your slices are large enough to test. Each stage earns the next one.

StageHow longThe checkMove on when
1. Report onlyAbout a weekComments, never failsYou have read a handful of comments and agree with them
2. Policy verdictUntil budgets settleFails on a busted budgetIts blocks match the PRs you would have blocked by hand
3. Slice blockingOngoingAlso fails on a slice dropOnly for slices with enough paired cases to test

In stage one you collect baseline runs on the trunk, everyone gets used to the PR comment, and nothing anybody does can be blamed on the new check. It also lines up with branch protection: GitHub's troubleshooting page says a required status check must have completed successfully in the repository during the past seven days, and a week of report-only runs provides those.

Do not skip stage one. The point of the calibration week is to find out whether your suite is noisy before that noise starts blocking merges, because a gate people learn to re-run until it passes is worse than no gate.

Which credential should the pipeline use?

A service-account key scoped to what the job does, stored as an encrypted CI secret, never a person's login. A personal token is tied to someone's membership and dies with it, which makes it exactly the wrong credential for a pipeline that has to outlive anyone's employment.

Never run an interactive login on a runner, and never expose the secret to pull_request_target, which runs the base repository's workflow with secrets in scope against fork code. Rotation is overlapping keys, never an in-place swap: mint the successor, update the secret, confirm a green run, then let the predecessor expire.

Doing this with EvalShift

Disclosure again: I'm the founder. The EvalShift GitHub Action is the four steps above as one uses: line. It runs the suite, pushes the completed run to EvalShift Cloud (a Cloud plan from $49 a month), asks the API for a compatible baseline run on the base branch, fetches the server-side diff, asks the server for the run's policy verdict, keeps exactly one PR comment updated in place, and sets the evalshift/regression commit status.

yaml
permissions:
  contents: read
  pull-requests: write
  issues: write
  statuses: write
jobs:
  evalshift:
    runs-on: ubuntu-latest
    env:
      EVALSHIFT_NONINTERACTIVE: "1"
      ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    steps:
      - uses: actions/checkout@v7
      - uses: evalshift/evalshift-action@v0
        with:
          token: ${{ secrets.EVALSHIFT_TOKEN }}
          fail-on: policy   # the default

What it needs

All four are hard requirements — the job fails without them:

  • +evalshift.yaml committed at the repository root, or the config: input pointed at wherever it lives. Paths inside the config resolve relative to the config file's own directory, so a config in a subdirectory works unchanged.
  • +A golden JSONL suite committed, or the suite: input pointed at it. The default is golden.jsonl.
  • +A repository or environment secret EVALSHIFT_TOKEN holding an es_... service-account key scoped to run:create, run:read and policy:read: run:create for evalshift push, run:read for the baseline lookup and the diff fetch, policy:read for the policy verdict. Leave out policy:read and the push still succeeds, but the default gate falls back to regression mode on every run, with only a warning on stderr.
  • +A model provider key in the job env matching the models named in evalshift.yaml — ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY (GOOGLE_API_KEY works too).

Mint the key in the web app under Settings, API tokens, Service accounts; the token evalshift login issues is personal, so never run login on a runner. The workflow evalshift init --ci writes skips the eval job on fork pull requests instead of failing on the empty token.

How it runs

It is a composite action, not a container: set up Python (3.12 by default), pip install a pinned evalshift CLI version, then a stdlib-only helper script that does the rest. All evaluation and statistics happen in the CLI; all diffing happens on the server. The action is the wrapper.

Two things are worth knowing before you stare at a log. Install is not cached, so budget roughly 20 to 60 seconds for it every run. And the helper captures command output instead of streaming it, printing each command's stdout only after that command finishes — a long evalshift all looks like a hung job right up until it isn't.

Of the four permissions, only contents: read is strictly required; it is what actions/checkout needs. pull-requests: write and issues: write buy the comment (PR comments are issue comments in the REST API), statuses: write the commit status. Drop them and you get stderr warnings instead — the gate still fails the job correctly.

Choosing fail-on

The fail-on input maps onto the three gate rules in step 3:

fail-onfails when
policy (the default)the server's migration-policy verdict for this run is fail
nevernever — reports only
regressionregression_count > 0
any-slice-regressionany per-slice pass_rate_delta < 0

policy reads the verdict on the run itself: pass, conditional_pass, fail or inconclusive, from the budgets in your migration_policy. Only fail blocks. A conditional_pass, where every budget held but a medium or low regression showed up, reports as a pass with a note to review before merging, and inconclusive reports as undecided without failing the job. If the policy check cannot be read, the action says so and falls back to regression.

The other three modes read aggregate_delta.regressions and per_slice_deltas off the server-side diff, with the empty-baseline behavior described above. For the rollout: ship with fail-on: never, remove the line after the calibration week to return to policy, and add any-slice-regression only when each slice carries enough paired observations to be testable — comparisons with fewer than 5 are skipped as insufficient, and a slice that keeps getting skipped will make this mode look erratic.

Gating locally

The CLI gates on its own analysis, no Cloud layer involved:

bash
evalshift compare --gate critical,high

--gate takes a comma-separated subset of critical,high,medium,low and exits 1 when any comparison lands on a listed severity. --policy-gate exits 1 when the migration verdict is fail or conditional_pass, which is stricter than the action's default policy mode, where a conditional pass does not fail the job.

--gate, --policy-gate and fail-on: policy all look at this run's own statistics, while the action's regression and any-slice-regression modes look at the diff against a baseline. A regression that is already in your trunk shows up in the first and not the second. When $GITHUB_STEP_SUMMARY is set, analyze appends a markdown results table to it, whether you invoke the CLI yourself or let the action do it.

FAQ

How do you run LLM evals in GitHub Actions? Add a workflow that triggers on pull requests touching your prompts, model config or golden suite, runs the suite against the base and candidate setups, and compares the result with a run from the base branch. Give the job a provider key from secrets, a timeout-minutes well under the 360-minute default, and a concurrency group that cancels superseded runs.

Should LLM eval failures block pull requests? Yes, once you trust the suite. Run it report-only for about a week first, then block on a verdict against budgets you wrote down in advance rather than on any movement, because single runs of the same model vary and a gate people re-run until it passes teaches them to ignore it.

How do you run LLM evals on pull requests from forks? GitHub does not pass secrets to workflows triggered from forks, so an eval job there has no provider key. Skip the job on fork pull requests with a job-level condition and run it once a maintainer pushes the branch; do not switch to pull_request_target, which runs fork code with your secrets in scope.

Why is my LLM eval check always green? Usually because there is nothing to compare against: with no run on the base branch, a diff-based gate counts zero regressions and passes. Check that the base branch has a recent run, or gate on a policy verdict, which judges the run itself instead of a diff.

How do you keep LLM evals in CI affordable? Trigger the workflow only on paths that can change model behavior, cancel superseded runs with a concurrency group, cache the base model's results keyed on the prompt and suite files, and keep the suite to the cases that matter. Every run makes real model calls, roughly suite size times two models.

Keep reading