By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A working pipeline has five jobs: run the fast checks, run the eval suite, compare against baseline, post the verdict, and fail the check when the gate trips. Here is a complete, readable version.
name: ai-quality
on:
pull_request:
paths: ["app/**", "prompts/**", "datasets/**"]
schedule:
- cron: "0 2 * * *" # nightly drift + full run
workflow_dispatch:
concurrency:
group: ai-quality-${{ github.ref }}
cancel-in-progress: true
jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install -r requirements.txt
- run: pytest tests/unit -q # no API key needed
eval:
needs: unit
runs-on: ubuntu-latest
timeout-minutes: 20
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: pip install -r requirements.txt
- name: Capture answers
run: python -m evals.capture --suite ${{ github.event_name == 'pull_request' && 'smoke' || 'full' }}
- name: Score
run: python -m evals.score --out results/run.json
- name: Gate
run: python -m evals.gate --run results/run.json --baseline baselines/main.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: ai-eval-results
path: results/
retention-days: 30Split capture from scoring. Capture answers once, score them many times. You can re-score with a new judge without paying for generation again.
Cache the baseline. Store the last known-good baseline.json in the repo or as an artifact. The gate compares against it.
Always upload artifacts, even on failure. A failed run with no artifacts is uninvestigable.
Set `timeout-minutes`. A hung provider call should fail in twenty minutes, not six hours.
Never print secrets. Use secrets.* and avoid echo of the environment.
Pull requests from forks do not receive repository secrets, by design. That means an AI eval cannot run on a fork PR. Two workable patterns:
A check named ai-quality with a one-line summary is worth more than a beautiful HTML report nobody opens. Post the failing case IDs and the metric deltas into the PR conversation:
ai-quality ✗ failing
smoke 15/15 pass
core 58/60 pass faithfulness 0.84 (min 0.85)
redteam 0 critical, 0 high
Blocking cases:
q_014 'Can I return a gift card?' faithfulness 0.42
q_037 'Do you ship to New Zealand?' faithfulness 0.48Key takeaways
Split the pipeline into unit, capture, score and gate jobs.
Capture once, score many times — it halves cost and enables re-scoring.
Upload artifacts always, and set a job timeout.
Forks do not get secrets: gate paid evals behind labels or the merge queue.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.