Test LLM prompt regressions in GitHub Actions
Build a small support-ticket test set, catch a valid JSON response with the wrong label, and run the same prompt evaluation locally and in GitHub Actions.
- Author
- Salon Rai
- 3 min read
A support classifier can return perfectly valid JSON and still send a customer to the wrong team. To test a large language model (LLM) prompt in GitHub Actions, give it tickets with agreed labels and compare each parsed answer with the expected route. That gives you a repeatable test for a prompt edit, including edits that leave the output format intact.
Specify the routing decision
Use two queues for this example. Billing owns charges and refunds. Technical support owns failures that prevent a product action from completing. The important example is “I cannot download my invoice PDF.” The noun invoice sounds like billing, but the reported problem is a failed download. The team that can fix the download gets the ticket.
Choose the expected labels before running the model. When two people disagree, record the rule that resolves the disagreement. A change in the business rule should change the expected answer. Keeping that decision visible makes a failing test much easier to interpret.
Put the prompt and three cases under version control
In a Node.js project, install Promptfoo with npm install --save-dev --save-exact promptfoo. Keep the resulting package manifest and lockfile with the test configuration. Save the following as promptfooconfig.yaml. It uses Anthropic’s Messages provider as an example. Select a model your account can access and use the same identifier for the baseline and candidate runs. Promptfoo Anthropic provider reference
prompts:
- |
Route this ticket to billing or technical.
Billing handles charges and refunds.
Technical handles failed actions, including invoice downloads.
Return only a JSON object with one field named "label".
Ticket: {{ticket}}
providers:
- anthropic:messages:claude-haiku-4-5-20251001
defaultTest:
assert:
- type: is-json
- type: javascript
value: |
const parsed = typeof output === 'string' ? JSON.parse(output) : output;
return parsed?.label === context.vars.expected;
tests:
- vars:
ticket: "I was charged twice for one order."
expected: billing
- vars:
ticket: "The settings page goes blank after I save."
expected: technical
- vars:
ticket: "I cannot download my invoice PDF."
expected: technical
The expected answer is available to the assertion through context.vars.expected. Only ticket is interpolated into the prompt. Accidentally including the expected label in the model input would make the exercise much easier than the production task. With your provider key available as ANTHROPIC_API_KEY, run npx promptfoo eval --no-cache to request fresh responses. Promptfoo JavaScript assertions
Distinguish a format pass from a routing failure
For the invoice ticket, consider this illustrative response.
{"label":"billing"}
The syntax check passes. The comparison evaluates to false because billing differs from technical. You can demonstrate a regression by editing the prompt to send every invoice issue to billing and repeating the run. The exact response is up to the model. The test’s expected result for this supplied response is deterministic. If a provider returns a timeout, inspect that separately from a response that actually contains an incorrect label.
Run the same evaluation in GitHub Actions
Save this workflow as .github/workflows/prompt-eval.yml in the project that owns the classifier. Add ANTHROPIC_API_KEY as an Actions secret. The manual trigger lets a maintainer run a reviewed revision and control when the three billable model calls happen. GitHub makes the manual trigger available once the workflow exists on the default branch. GitHub manual workflow documentation
name: Evaluate support routing
on: workflow_dispatch
permissions:
contents: read
jobs:
evaluate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: npm ci
- run: npx promptfoo eval --no-cache
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Read failures by ticket as well as by total. Two prompt revisions can both score two out of three and still send different tickets to the wrong team. For a disputed case, compare responses across repeated runs with the same inputs. Save the prompt revision, model identifier, expected label and observed label with the result. Synthetic examples such as these also keep customer details out of workflow logs.
Review the case that changed between revisions
Suppose the original prompt correctly sends the invoice-download ticket to technical support but sends the duplicate-charge ticket there too. You edit the prompt to emphasize billing keywords. The new revision gets the duplicate charge right and sends the download to billing. Looking only at the number of passes would hide the exchange.
| Ticket | Expected queue | Example baseline | Example candidate |
|---|---|---|---|
| Duplicate charge | Billing | Technical | Billing |
| Settings page goes blank | Technical | Technical | Technical |
| Invoice download fails | Technical | Technical | Billing |
This is a hypothetical comparison, so it can also serve as a fixture for testing a report. Record the cases the candidate improved and the cases it regressed. The billing team may agree to handle both invoice issues, in which case the routing policy and expected labels need an explicit revision. If the policy still depends on whether an action failed, the candidate lost a distinction you intended to keep.
For a growing suite, give every case a stable ID. That lets reviewers follow the same scenario when you shorten its wording, change models or add a third queue. Save only the response fields needed to explain a failure.
Next steps
Add a case whenever a real routing mistake reveals a missing rule, using a short fictional ticket with the same ambiguity. Keep a separate set for evaluating bigger changes so you can tell whether a prompt generalizes beyond the examples used to edit it. If you run this workflow frequently, use the LLM request cost walkthrough to estimate its cost from actual token usage.

Written by