Originally published on DevToolHub.
To test LLM prompts in GitHub Actions, run an eval on every pull request that touches a prompt file, fail the job below a pass rate, and add a per-label check. The pass rate alone misses a category that breaks while the total stays high. In my test a prompt edit scored 90% and passed the gate while one ticket category fell from 3 of 3 to 2 of 3.
I ran everything on 27 November 2026 in a private throwaway repository, on a GitHub-hosted runner, with Promptfoo 0.126.0 and the llama3.2:3b model. It needs no API key and costs nothing but runner minutes. The last section lists what I did not test.
In this guide:
- Wire a prompt eval into a pull request check with a real workflow
- Set the pass-rate threshold and know what exit code CI sees
- Catch a broken category that a 90% pass rate hides
- Avoid the traps: a gate the PR can edit, and results that change between machines
How do you test LLM prompts in GitHub Actions?
Keep the prompt and the eval config in the repository, then run the eval in a workflow that triggers only when those files change. The eval sends each test case to the model, checks the answer with an assertion, and exits non-zero when too many cases fail.
My example is a support-ticket classifier. The model must answer with one word: billing, bug, feature or other. Then ten test tickets each carry an expected label.
description: ticket classifier prompts: - file://prompts/classify.json providers: - id: ollama:chat:llama3.2:3b config: temperature: 0 seed: 7 defaultTest: options: transform: output.trim().toLowerCase().replace(/[^a-z ]/g, '') assert: - type: javascript value: output === context.vars.expected tests: - vars: {ticket: "I was charged twice for my March invoice.", expected: billing} - vars: {ticket: "The export button crashes the app every time.", expected: bug} - vars: {ticket: "Please add dark mode to the dashboard.", expected: feature} - vars: {ticket: "What are your office hours?", expected: other} The real file has ten tests. I trimmed it to four here. The workflow installs Ollama on the runner, pulls the model and runs the eval:
name: Prompt eval on: pull_request: paths: - "evals/**" permissions: contents: read jobs: eval: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: actions/setup-node@v7 with: node-version: 24 - name: Install Ollama and pull the model run: | curl -fsSL https://ollama.com/install.sh | sh (ollama serve > ollama.log 2>&1 &) for _ in $(seq 1 30); do curl -s localhost:11434 >/dev/null && break sleep 1 done ollama pull llama3.2:3b - name: Run the eval env: PROMPTFOO_PASS_RATE_THRESHOLD: "80" run: | npx --yes promptfoo@0.126.0 eval \ -c evals/promptfooconfig.yaml --no-cache -o results.json The install line comes from the Ollama Linux docs. I pinned the promptfoo version because an eval tool that changes under you makes a red check hard to trust.
Note: On a pull request, this workflow uses
contents: readand no secrets, because the model runs on the runner. A hosted model with an API key changes the security picture. The last section covers it.
Why does a plain-text prompt score 0 out of 10?
Because the ollama:chat provider sends your prompt as a chat message, and a small model may treat a few-shot text block as a document to continue. My first plain-text prompt, with a Label: cue, scored 0 of 10 locally. Every answer started with "here are the classification" and then repeated an example.
So the fix was a chat-format prompt file with a system message and the ticket as the user message, which is what prompts/classify.json holds. The Promptfoo Ollama provider docs list ollama:chat:<model> for chat-formatted prompts and ollama:completion:<model> for plain ones. Match the prompt format to the provider.
Then there was my other first-run failure: a typo. The config named llama3.2:1b while the workflow pulled 3b. All ten calls returned an Ollama 404, the summary read 0 passed and 0 failed, and the job still went red. That is the right behaviour, but the numbers look odd at first glance.
What does the pass-rate threshold do when you test LLM prompts in GitHub Actions?
By default, promptfoo eval exits with code 100 when any test fails. A model that gets 8 of 10 right would fail your pull request check on day one. PROMPTFOO_PASS_RATE_THRESHOLD sets the minimum pass rate as a percentage, and the command-line docs say the default is 100.
I ran the same 80% result against three thresholds:
| Threshold | Pass rate | Exit code |
|---|---|---|
| not set | 80% | 100 |
| 80 | 80% | 0 |
| 90 | 80% | 100 |
| 70 | 80% | 0 |
Below the threshold, the log prints a line like Pass rate 70.00% is below the threshold of 80%. So set the threshold to your measured baseline, not to a round number you wish for.
What happens when a pull request edits the prompt?
The check should go red when the prompt gets worse and stay green when it does not. I planted five edits in pull requests against a baseline of 10 of 10, all on the real runner:
| PR | Edit | Pass rate | Threshold step | Label check |
|---|---|---|---|---|
| 1 | Reworded the eval description only | 10/10 | pass | pass |
| 2 | "Friendlier" prompt wording | 10/10 | pass | pass |
| 3 | Removed the examples line | 9/10 | pass | fail (billing 2/3) |
| 4 | Deleted the billing rule | 7/10 | fail | fail (billing 0/3) |
| 5 | "Explain briefly, then give the label" | 1/10 | fail | fail |
The last edit shows the failure everyone expects. The model started writing sentences instead of one word, and 9 of 10 answers broke the exact-match assertion.
But pull request 2 surprised me. The same "friendlier" edit scored 2 of 10 on my Mac, inside Docker. I come back to that below.
Why does one pass rate hide a regression when you test LLM prompts in GitHub Actions?
Because 9 of 10 clears an 80% threshold even when the one miss is a whole category going dark. In pull request 3, removing the examples line cost one billing ticket. The aggregate said 90% and the threshold step passed. Billing had dropped from 3 of 3 to 2 of 3.
Pull request 4 is worse, though. Billing fell to 0 of 3 while the other labels held. If the threshold sits at 60, a 70% result passes with a dead category.
So I added a second step that compares each label with a stored baseline:
- name: No label may fall below its baseline if: ${{ !cancelled() && hashFiles('results.json') != '' }} run: | jq -r '.results.results[] | "\(.vars.expected) \(.success)"' results.json \ | awk '{t[$1]++; if ($2=="true") p[$1]++} END {for (l in t) print l, p[l]+0, t[l]}' \ | sort > per-label.txt cat per-label.txt fail=0 while read -r label passed total; do need=$(jq -r --arg l "$label" '.[$l]' evals/baseline.json) if [ "$passed" -lt "$need" ]; then echo "::error::$label dropped to $passed/$total (baseline $need)" fail=1 fi done < per-label.txt exit $fail The evals/baseline.json file holds the passes each label must keep: {"billing": 3, "bug": 3, "feature": 2, "other": 2}. On a healthy run the step prints this and passes:
billing 3 3 bug 3 3 feature 2 2 other 2 2 On pull request 3 it printed billing 2 3 and failed the check with billing dropped to 2/3 (baseline 3). That is the regression the threshold step let through.
Can a pull request change the gate itself?
Yes. A pull_request workflow runs the version of the workflow file in the pull request. I did not find that spelled out on the events reference page, so I tested it. In pull request 7 I deleted the billing rule and also changed PROMPTFOO_PASS_RATE_THRESHOLD from 80 to 60. The eval step used 60 and passed at 70%. Only the label check failed.
Warning: Anyone who can open a pull request can edit the threshold, the baseline file or the label check in the same pull request. Protect
.github/workflows/andevals/baseline.jsonwith required reviewers. I did not test CODEOWNERS or rulesets here. See the CODEOWNERS guide for the setup.
If you move to a hosted model, you need an API key. As I read the events reference, pull_request runs from forks do not get your secrets, and it warns against running pull request code under pull_request_target. I tested neither. The security best practices guide covers both.
Why do the same prompt and seed score differently on another machine?
Because a fixed seed makes one machine repeatable, not every machine identical. I set temperature: 0 and seed: 7. Two runs in my Docker container both scored 8 of 10 with the same two misses. The runner scored 10 of 10 on the same files, twice.
Here are the same five prompts on both:
| Prompt | Docker on my Mac | GitHub runner |
|---|---|---|
| Baseline | 8/10 | 10/10 |
| "Friendlier" wording | 2/10 | 10/10 |
| Examples removed | 7/10 | 9/10 |
| Billing rule deleted | 6/10 | 7/10 |
| "Explain, then label" | 0/10 | 1/10 |
However, pull request 3 reproduced exactly on the runner when I re-ran it: 9 of 10, billing 2 of 3. So the runner is stable against itself. Set your baseline there, because that is where the check runs.
Temperature matters more. At temperature: 1 and no seed, the baseline prompt scored 40%, 50%, 50%, 60%, 60% and 70% across six runs on my Mac. That spread would make a pass-rate gate flip at random. Also keep temperature at 0 for a CI eval.
Does caching the model speed up how you test LLM prompts in GitHub Actions?
No. A full run took about three to four minutes. First, installing Ollama and pulling the 2 GB model took roughly 1.3 minutes, and the eval itself took 30 to 35 seconds.
I added an actions/cache step for ~/.ollama/models and ran it twice. The first run, which filled the cache, took 3 minutes. On the second run the cache restored, but the job took 3 minutes 46 seconds. The restore added 23 seconds, and the install still ran. Because the runner downloads the model quickly, caching buys nothing here.
Ten test cases is also a small sample. A one-ticket difference is 10 points, so 90% and 100% are not statistically different. So use more cases before you trust a small gap.
For a wider view on running tests in a workflow, see the GitHub Actions testing guide. The GitHub Actions guide covers what else breaks in real pipelines.
What I did not test
I used one private repository, one model (llama3.2:3b), one eval tool and ten test cases. Untested: the promptfoo/promptfoo-action GitHub Action, which posts a before-and-after comment on the pull request. Also untested: a hosted model with an API key, fork pull requests, pull_request_target, CODEOWNERS or rulesets, LLM-as-judge assertions, and editing baseline.json in the same pull request as a prompt change. The Ollama version the install script served on the runner went unrecorded. The ubuntu-latest label resolved to the ubuntu-26.04 image that day.
Frequently Asked Questions
Q: How do I test LLM prompts in GitHub Actions without an API key?
A: Install Ollama on the runner, pull a small model and point your eval tool at it. I used llama3.2:3b with Promptfoo. A run took about three to four minutes and cost no API fees.
Q: Why does my prompt eval fail CI even when most tests pass?
A: promptfoo eval exits with code 100 when any test fails, unless you set PROMPTFOO_PASS_RATE_THRESHOLD. Set it to your measured baseline. An 80% result exits 0 at a threshold of 80 and exits 100 at 90.
Q: Is a pass-rate threshold enough to catch a prompt regression?
A: No. A 9 of 10 result passed an 80% threshold while billing fell from 3 of 3 to 2 of 3. Add a per-label check against a stored baseline so a whole category cannot fail quietly.
Q: Do LLM eval results stay the same between my laptop and CI?
A: Not reliably. With a fixed seed and temperature 0, my container scored 8 of 10 and the runner scored 10 of 10. Measure your baseline on the runner and keep temperature at 0.
Quick Summary:
- Run the eval only when
evals/**changes, withcontents: readand a pinned tool version -
promptfoo evalexits 100 on any failure, so setPROMPTFOO_PASS_RATE_THRESHOLDto your measured baseline - A 90% pass rate cleared an 80% threshold while billing dropped from 3/3 to 2/3, so add a per-label check
- A pull request can edit the threshold and the baseline, so protect
.github/workflows/andevals/baseline.json - The same seed gave 8/10 on my Mac and 10/10 on the runner, so set the baseline on the runner
- Caching the 2 GB model saved nothing, and a full run took about three to four minutes
Copy the workflow into a scratch repo, break a prompt on purpose, and watch which step catches it. That is the fastest way to learn whether your setup can really test LLM prompts in GitHub Actions.


