AI agents in CI/CD pipelines

ExplainedAI agentsDevOps, Hands OnBy Cloud Hands On

Where AI helps in pipelines (reviews, summaries, failure explanations) and the rules that keep it safe.

Good jobs for AI in a pipeline are ones where a person reads the output anyway: reviewing a pull request's diff, summarising changes for release notes, explaining why a build failed. The AI step produces advice, posted as a comment or a job summary.

Pipelines are a tempting target, because they hold secrets and can deploy. So the AI step gets the least: read access to code, permission to comment, no deployment credentials, no approval or merge rights. Use the pull_request trigger so forked pull requests get a read-only token and no secrets.

The diff, the pull request text and commit messages are all untrusted input that may carry prompt injection. Keep the AI step's output out of anything executed, never let it approve its own work, and keep evaluation cases for the reviewer like any other agent.

Cost. Free to practise with a rule-based reviewer in a public repository. Real models cost per token, or use a free rate-limited tier for trials.

Use it when

How it works

Pick advisory jobs
Reviews, summaries, explanations.
Least privilege
contents: read, pull-requests: write.
Safe triggers
pull_request, not pull_request_target with PR code.
No secrets
Except a scoped model key, never for forks.
People decide
AI comments; humans approve and merge.

Options

Rule-based reviewer
Free and predictable; catches known patterns.
Model-based reviewer
Catches more, costs tokens, needs evaluations.

Example. Kestwick Hotels' pull requests get an AI summary and a list of risky changes as one comment, updated on each push. Required approvals still come from two engineers; the AI can't approve anything.

Don't confuse it with

AI review comment
Advice a person weighs.
Required check
A gate that blocks merging; keep AI out of this until it's proven.

Words to know

Advisory step
A step whose output informs people but blocks nothing.
pull_request_target
A trigger that runs with the base repository's rights; risky with untrusted code.
Job summary
Markdown a workflow step shows on the run page.

Where to look

  1. Repository
  2. .github/workflows
  3. Pull requests

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going