How promptfoo in GitHub Actions checks every prompt change before merge
Promptfoo runs as a CLI inside a GitHub Actions workflow that starts on each pull request, and the evals execute on the runner and call the model provider directly. For a team changing a prompt or swapping a model, the question before merge is whether answer quality or safety moved, and the workflow answers it with the same test cases on every change. The most useful setup produces a before and after comparison: the prompt or model as it exists on the target branch, run against the same cases as the proposed change. Reviewers then see which cases changed, by how much, and what the overall pass rate did. Promptfoo's introduction describes this local execution model.
The job's pass or fail outcome should be a decision the team made in advance, written into the workflow and reviewed like any other code. Decide which assertions block the merge, what pass rate a change must meet, and whether a case that passed on the target branch and fails on the proposed change blocks on its own. Confirm in the action's documentation how a failed assertion or threshold sets the job status, so you know whether the job fails on any regression or only below a set rate. Then make that job a required status check in branch protection, so a red result stops the merge, and test that path once with a deliberately broken prompt.
The pipeline runs inside your own GitHub organization, in repositories and on runners you control, and the eval configuration, test data and prompts live in the same repository as the code they govern. Model provider keys are the sensitive part of this setup, so confirm which scope holds each secret, who can read it, and whether workflows triggered from forked pull requests can reach it. Ask your security team to review the workflow file's permissions and any runner that will hold a key. Your platform team should also confirm that each runner has a network path to every model provider under test, because the evals call those endpoints directly from the runner.
What the workflow needs before the first run
Six items need to be in place before a pull request can trigger a promptfoo eval. Most are one-time repository and account setup, and each one fails in a different way, so confirm them in the order listed before you make the check required.
Node.js and a pinned promptfoo
Set the runner to use Node.js 22.22.0 or newer, which is the minimum version the promptfoo 0.124.1 release requires. Pin the promptfoo version in the workflow and in your lockfile, and avoid installing whatever is latest. Test the exact version you pin, and confirm the current release on npm before you copy a version number into a workflow. The Community edition is free and includes all LLM evaluation features and model providers, but confirm which features your CI job needs before assuming no paid edition is required.
promptfoo on npmProvider account and spend limits
Each model provider needs an account and an API key that the workflow reads from GitHub secrets. Set provider-side spend limits before the first run, so a pull request that loops or sends a large dataset cannot run up an unbounded bill. Ask whether the provider offers project-scoped keys and usage caps, and check which models your config calls. Also check how your workflow handles pull requests from forks, because access to secrets is restricted for those runs by default.
GitHub repository and secret rights
The repository needs GitHub Actions enabled and an account with rights to create repository or environment secrets. Keep the provider key out of the workflow YAML and the promptfoo config, and reference it only through secrets stay out of the repository style storage in GitHub. Confirm who can read workflow logs, since eval output can echo prompts and model responses. Also confirm that branch protection rules allow the eval check to be required before merge.
Outbound network access to providers
Runners must reach each provider endpoint over HTTPS, and any proxy, egress firewall or allowlist in front of them must permit those hosts. Hosted runners generally have outbound access, but private networks and self-hosted runners behind corporate firewalls often need explicit rules. List every host the config calls, including any AI gateway or internal endpoint under test. Then run a small eval to confirm the connection before you run the full suite.
Committed config and baseline dataset
Commit the promptfoo config and a baseline dataset to the repository, so every pull request is compared against the same starting point. The baseline should record the current prompt's outputs and pass rate on a fixed set of cases, which gives the before and after comparison its reference. Keep the dataset small enough that each run's cost is predictable, and agree on who reviews changes to the test cases themselves.
promptfoo introductionHosted or self-hosted runners
Prompts, test data and model outputs pass through the runner during the job, so the runner is part of your data handling boundary. Prompts and outputs pass through the runner, which means its image, logs and cache settings matter for sensitive content. GitHub-hosted runners are managed by GitHub, while self-hosted runners stay inside your network under your control. Choose based on how sensitive your prompts and data are, and confirm retention settings with the team that owns the runner.
How a pull request flows from prompt change to provider and back
The flow starts when a developer opens or updates a pull request that changes a prompt, config or test file. A GitHub Actions workflow job starts on a runner, and the promptfoo CLI reads the config and prompts from the checked-out repository. The CLI then calls the model provider API directly from the runner, so prompts and test inputs cross the provider boundary and responses come back. Repository secrets reach only the eval job that needs them. The results return as a job status and artifacts on the pull request. When reviewing, check which job receives secrets, what leaves the runner, and whether the runner is GitHub-hosted or self-hosted.
Trust boundaries and secret scope in one pull request run.
Configure the workflow in six steps, each closed by a check
The sequence below moves from a stored provider key to a pull request check that fails when prompt quality regresses. Each step ends with a check you can observe, so a problem surfaces at the step that introduced it, before any team member relies on the check.
Store the provider key as a secret
Add the model provider API key as an encrypted GitHub secret, at repository or organization level, and reference it through the secrets context in the workflow. Repository administrators own this step and should limit the secret to the repositories that run evals. The check: a test run confirms the job can read the variable, for example by checking its length in a shell step, without printing the value to the log.
Create a pull request workflow with path filters
Add a workflow file under
.github/workflowsthat runs onpull_requestevents, with path filters for the prompt, config and dataset files, so pull requests that touch only unrelated code do not consume API budget. Developers and the team lead who owns evals write this file in the application repository. The check: open a test pull request that changes one prompt file and confirm the workflow appears in the Actions tab, then open one that edits only a README and confirm it does not start. Pull requests from forks do not receive repository secrets, so decide how those run before you rely on the check.Check out base and head revisions
Check out the base and head commits of the pull request into separate directories in the same job. Run both sides with the same dataset file, taken from the base revision, so the comparison isolates the prompt change and a dataset edit in the pull request does not shift the baseline. Dataset changes need their own review. The check: the job log lists the files in each directory, and the prompt files differ between them in the same way the pull request diff shows.
Install pinned Node.js and promptfoo versions
Set up Node.js 22.22.0 or newer with the Node.js setup action, then install a promptfoo version you have tested, pinned to an exact number so an upgrade is a deliberate change you can review. Release 0.124.1, published on npm on 8 October 2026, requires Node.js 22.22.0 or newer, so confirm it works with your config before you pin it. The check: the job prints the Node.js and promptfoo versions before any eval starts, and the printed promptfoo version matches your pin.
Run the official action with required inputs
Call the official promptfoo GitHub Action with its required inputs. Before copying the action name, version tag and input names, confirm them in promptfoo's CI documentation. Pass the provider key from the secret through the environment, point the action at your config file, and write results to a path the job can upload as an artifact. The check: a dry run on a test branch completes, the eval summary appears in the job log, and the results file exists in the workspace.
Set the job to fail on regression
Configure the job to exit non-zero when an assertion fails or the pass rate falls below the threshold you set, so the pull request turns red on a regression. Then deliberately weaken a prompt in a test pull request, for example by removing an output format instruction, and confirm the job fails. Next, check that the status check appears on the pull request. Add the check to branch protection as a required status check only after it has behaved consistently across several runs.
How before and after comparisons of prompt changes work
A before and after comparison runs the same promptfoo evaluation twice on a pull request. The baseline run uses the base branch, which holds the prompt as it currently stands on the main line, and the candidate run uses the head branch, which holds the proposed change. Both runs read the same datasets, the same assertions and the same model settings, so the prompt is meant to be the only variable that moves. Before you trust the result, confirm in your workflow that each run checks out the correct branch and that nothing outside the diff, such as a shared dataset path, a provider setting or an environment variable, changes between the two runs. Any variable that differs between them will show up in the results as if the prompt caused it.
Read the pass rate change as the headline, then read the per-case outcomes beneath it. A flat or slightly higher pass rate can hide a regression if a case that passed on the base branch now fails while a different case is fixed. Sort the cases into four groups: passing on both, failing on both, newly failing and newly passing. Open the output for every newly failing case before approving the change, and confirm that each newly passing case is a genuine improvement and not an assertion that became easier to satisfy. A comparison is only as fair as the shared test set. If the cases are few, narrow, or were written around the new prompt, the candidate will look better than it is, and a small pass rate change on a small set tells you little.
Add new test cases in a separate pull request from the prompt change. If both land together, the candidate run scores the prompt against cases the base run never saw, so a drop in pass rate may reflect harder cases and a rise may reflect easier ones. Merge the test case pull request first, so the base branch already contains the expanded set, then open the prompt change against it. This keeps the bar fixed while the prompt moves. Give the test case pull request its own review, with the same owners who approve assertions, and flag any edit to an existing expected answer, since changing an answer moves the bar just as much as adding a case. Confirm how your version of the action reports results so you know which run each number belongs to.
Which secrets, files and results map to which job step
This table maps each secret, file and result in a promptfoo pull request workflow to where it lives, which job step reads it and who controls it. Read it top to bottom before wiring the workflow, because the base and head revisions decide which config and dataset versions are tested. The main takeaway is that secrets should stay in GitHub secret stores controlled by the client, while the pass threshold and results must be set where reviewers can see changes.
| Item | Where it lives | What reads it | Who controls it |
|---|---|---|---|
| Provider API key | Repository or environment secret in GitHub Actions | promptfoo at run time, during the eval step | Repository or environment owners, through GitHub secret settings |
| Promptfoo config and prompt files | Repository, at both the base and head revisions | promptfoo in the eval step, once per revision | Developers, through pull request review |
| Test datasets | Repository or approved storage the runner can reach | promptfoo during the eval step as test case sources | Data owners and the team that approves the storage location |
| Base and head revisions | GitHub event context for the pull request | Checkout and comparison steps in the workflow | GitHub, set by the pull request's base and head commits |
| Pass threshold | Workflow input or promptfoo config value | The gate step that decides whether the job fails | Team that approves changes to the workflow or config |
| Results artifact | Uploaded from the job run and kept by GitHub | Reviewers and any later comparison step | Repository administrators, who set retention and access |
| Pull request status | GitHub commit status on the pull request head | Branch protection and required status checks | Repository administrators |
| Provider environment variables | Job environment entries mapped from secrets | promptfoo, for whichever provider the config names | Provider documentation sets the names. Confirm each one before wiring secrets. |
Caching to control API cost in CI
Cost in CI grows with three numbers: the number of eval cases, the number of models each case runs against, and how often the job runs. Every case on every pull request sends requests to a model provider, and the provider bills those tokens to your organization. The promptfoo Community edition is free and includes all LLM evaluation features and all model providers, so the recurring spend in this workflow is provider tokens plus GitHub Actions runner time. Before you enable the job, multiply cases by providers and any repeats you configure, then by the pull requests your team opens each week. Check that estimate against the provider's usage dashboard after the first week. The first lever is path filtering. Under on.pull_request.paths, list the prompt files, promptfoo config files and test data directories so the job runs only when they change. Include any shared helper file the prompts import, or a relevant change will skip the eval.
The second lever is a split test plan. Run a smoke set on every pull request: a smaller config that covers your highest-risk prompts, ideally pointed at the lowest-cost model that still represents production behavior. Run the full suite on a schedule with on.schedule and on demand with workflow_dispatch, so the complete comparison still runs regularly without billing on every push. Decide in writing which smoke failures block a merge and which only warn. The third lever is promptfoo's cache. Confirm in the current promptfoo caching documentation where the cache is written, how your workflow must save and restore it between runs, and what invalidates an entry, such as changes to the prompt text, provider settings or model name. Then test it: run an unchanged branch twice and compare provider usage for the two runs. If the second run still makes full calls, the cache is not being restored and the workflow needs fixing.
Provider spending limits are set by the people who own each model provider account, usually an organization owner or billing administrator, in that provider's console. Ask them which limit types exist, such as monthly caps or per-project budgets, and whether a cap stops requests or only sends an alert. Give CI its own API key or project so a runaway job reaches its budget before production traffic is affected, and store that key in your CI secret store. Cache reuse also needs a review rule. A cache restored from the default branch can return results that no longer match a pull request's configuration if the cache key misses an input. Schedule a full run without the cache on a regular basis and compare its pass rate with the cached runs. Name the owner of the provider budgets before the workflow goes live, because a budget only protects you once someone has set it.
Where secrets should live and how far a pull request can reach
Every promptfoo run in a pull request can spend a provider key and send data to a model provider, so these controls decide what an untrusted change can reach. Settle the secrets, fork policy and token scope before the first workflow is merged. Team access control, SSO and custom roles belong to the paid Enterprise edition, so confirm whether your team needs them before you plan the rollout.
Provider keys in environment secrets
Store each provider key as an environment secret so a job can read it only after the environment's protection rules pass. Require reviewer approval for any environment that reaches paid or production model accounts. Then check that the key never appears in workflow logs, step summaries or uploaded artifacts, and that no generated config file embeds it. Test this with a deliberately failing run before you rely on it.
Written policy for fork pull requests
Decide in writing whether pull requests from forks may run evals that use your keys. GitHub does not pass repository secrets to workflows triggered by fork pull requests by default, but a workflow using the pull_request_target event runs with access to secrets. Confirm which trigger your workflow uses and test it with a fork before you rely on the policy.
Least-privilege workflow token
Declare a permissions block so the GITHUB_TOKEN starts read-only and gains write scopes only in the job that needs them. A promptfoo job that reads the config and reports results needs no write access to repository contents. Add pull-requests: write only when the job posts a comment on the pull request. Review the block whenever the workflow changes.
Pinned action and promptfoo version
Pin the official action to a full commit SHA that your team has reviewed. Pin the promptfoo package to an exact version so an upstream release cannot change grading between two pull requests. For example, the npm registry lists release 0.124.1 as published on 8 October 2026, and it requires Node.js 22.22.0 or newer, so set the runner's Node version to match. Upgrade on purpose, with a reviewed pull request.
Data path and provider retention
promptfoo runs on the CI runner and calls each provider directly, so prompts, test inputs and model outputs leave your pipeline for the provider. Read the provider's retention terms for the account and region you use, and record what they say about storage and training. Check whether eval inputs contain customer or patient data before anyone commits them to the repository.
promptfoo introductionRed team scans need eval controls
Red team scans send attack payloads, including jailbreak and prompt injection attempts, to the provider. They deserve the same secrets, fork and retention controls as evals. Confirm whether scans run on fork pull requests, where a contributor could influence which probes run. Treat scan output as sensitive, because it can show how your application fails.
- Community probes monthly
- 10k
Common promptfoo GitHub Actions failures, their cause and fix
This table lists failures teams commonly hit when promptfoo runs in GitHub Actions, with the likely cause and fix for each. Read each row as a symptom you might see in a failed run, then check the cause against your workflow file and repository settings. The main takeaway is that many of these failures trace back to three areas: how secrets reach fork pull requests, how versions and caches are pinned, and how the checkout and reporting steps are set up.
| Failure | Likely cause | Fix |
|---|---|---|
| Secrets missing on pull requests from forks | By default, GitHub withholds repository secrets from workflows triggered by pull requests from forks, so the provider key is empty. | Run model-backed evals only on same-repo branches, or gate fork runs behind a maintainer-approved label or a separate workflow. |
| Node.js version below the minimum | Release 0.124.1 on npm requires Node.js 22.22.0 or newer, and the runner default may be older. | Set Node.js to 22.22.0 or newer in the setup step before the promptfoo step runs. |
| Workflow breaks after a version change | Unpinned promptfoo or action versions pick up new releases that can change flags, defaults or output files. | Pin both to tested versions and upgrade in a separate pull request with a full passing run. |
| Unexpected spend after a cache miss | A changed cache key, such as after prompt or config edits, can force every test case to call the provider again. | Confirm the cache key and path in your workflow, and set a provider spend limit before large comparison runs. |
| Provider rate limits or timeouts fail the job | Parallel requests can exceed the provider's rate or token limits, and a slow model can pass the request timeout. | Lower concurrency, enable retries in the eval configuration, and confirm your account limits with the provider. |
| Comparison shows no differences | A shallow checkout omits the base branch history, so the before run has nothing valid to compare against. | Set fetch-depth to 0 in the checkout step, or fetch the base ref explicitly before the comparison runs. |
| Results not visible to reviewers | Output stays on the runner, or the job posts no summary, so reviewers see only a pass or fail status. | Write results to a file, upload it as a workflow artifact, and add a job summary with the pass rate and changed cases. |
| Flaky pass rates make the gate unreliable | Model output varies between runs, so a case near the threshold can pass once and fail on the next run. | Use deterministic assertions where possible, set temperature to 0 if the provider supports it, and set the gate from repeated baseline runs. |
What buyers ask before a partner sets up promptfoo in GitHub Actions
What does a promptfoo GitHub Actions setup cost and what drives it?
DeployOpen works to a fixed scope, and the quote follows from that scope agreed in writing before work starts. The main drivers are the number of pipelines and repositories that run promptfoo, how many datasets need to be connected, how many model provider accounts the evals call, and whether the workflow permissions and secret handling need a security review. Each item adds configuration, testing and documentation work. Some costs are one-time, such as the setup itself. Others recur and are billed to your own accounts, such as GitHub Actions minutes and model API usage. Ask for a quote that lists each pipeline, dataset, provider and review as its own line, and that states what is excluded. DeployOpen does not publish a price list.
How long does it take to set up promptfoo in GitHub Actions?
The timeline follows from the written scope, and a fixed-scope agreement sets it before work starts. The factors that change the duration most are how many repositories and pipelines are involved, whether datasets are ready to load, and how long your approvals take for provider keys and environment secrets. A security review of workflow permissions and secret handling adds a review cycle. Provider account approvals are often outside the partner's control, so start those early. Ask for a timeline that shows the dependencies: who approves each step, which datasets arrive when, and which review gates the pipeline must pass before it goes live. Confirm these dependencies with your own change board before you agree a start date.
What must our team provide before a promptfoo CI setup starts?
Plan to provide repository access with permission to change workflow files, the model provider accounts and API keys the evals call, the datasets or test cases to run, and named approvers for secrets. Repository access should cover the branches and environments where the workflow will run. Provider accounts should be dedicated to evaluation, with spending limits you set yourself. Each dataset needs an owner who can confirm it contains no personal data you are not permitted to send to a model provider. Approvers decide who can read each secret and which environments may use it, so name them before work starts. Your team also owns branch protection rules and the decision about which pass rate blocks a merge. Confirm each item in the written scope so nothing is missing on the first day.
Can our internal team set up promptfoo in GitHub Actions alone?
Yes, a team with CI experience can set up a basic pipeline alone: a promptfoo config, a workflow that runs evals on each pull request, and a provider key stored as an encrypted repository secret. That is a reasonable first step for a small set of prompts. Outside help usually becomes useful in a few areas. Caching tuned to control API cost, secret scoping across environments and forked pull requests, pass-rate gates set against a baseline, and red team scans against your application all need careful setup. Security review of workflow permissions and the evidence an assessor will ask for are other common gaps. DeployOpen prepares systems, controls and evidence for compliance assessments, but it does not issue audit reports or certifications. Independent auditors and certification bodies do that.
Does the free promptfoo Community edition cover running evals in CI?
The promptfoo pricing page lists the Community edition as free, with all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month. Because evals run locally and talk directly with the model, a pipeline built on the Community edition can run evals on each pull request without an Enterprise license. Confirm three things before you rely on it. First, check that your red team scan volume fits within 10k probes per month across all pipelines. Second, check whether you need team sharing, SSO or teams-based access control, since those sit in Enterprise. Third, check the feature list for the version you pin, because features and limits can change between releases.
When does promptfoo Enterprise matter for GitHub Actions pipelines?
promptfoo Enterprise matters when several teams need to share eval and red team results, or when access to those results must follow your identity provider. It adds team sharing, teams-based access control and SSO, custom roles and permissions, continuous monitoring, a centralized guardrail dashboard, remediation recommendations and priority support with SLAs. These features sit outside the Community edition and are sold at custom pricing, so the cost comes from a quote. promptfoo On-Premise runs the Enterprise functionality on your own infrastructure, with complete data isolation and a dedicated deployment engineer. Before you choose a tier, ask the vendor to confirm which features apply to your pipelines and whether any data must leave your network.
How DeployOpen scopes and delivers the promptfoo pipeline
DeployOpen treats promptfoo in GitHub Actions as a fixed-scope engagement. We agree in writing which repositories, pull request workflows, providers, eval suites and secret stores are covered before any build starts. The work runs in infrastructure you control, and promptfoo itself stays on the MIT license.
How we scope
- The written scope names the repositories, pull request triggers and workflows that run promptfoo evals.
- It records which model providers and API keys the workflows call, and where each secret is stored.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
How we build
- Eval suites are written against your prompts, with before and after comparison jobs for each prompt change.
- Workflow files set the required inputs, and caching is configured to limit repeat API calls and cost.
- Provider keys are stored in GitHub Actions secrets or your chosen store and kept out of workflow files.
How we hand over
- Handover includes the workflow files, eval configs and a runbook for updating prompts and test cases.
- Documentation covers required secrets, cache keys, eval thresholds and how to read a failed pull request check.
- Acceptance runs on a test pull request, so your team sees the comparison output before merging.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Upgrade reviews cover promptfoo releases, Node.js version requirements and the GitHub Action version pinned in workflows.
- Continuous testing can add new eval cases as prompts change, with results reviewed by your team.

