// module 08 · AI agents in the pipeline
AI review in CI without giving it the keys
An AI reviewer on every pull request is cheap and often useful. It is also a model reading text an attacker wrote, inside a job that holds a model key and a GitHub token. This lesson builds the reviewer so that nothing it says can change the repo: the job with the key can only read, a separate job with no key posts the comment, the model gets Read, Grep and Glob and nothing else, and the verdict is never a required check. We build it twice, with `anthropics/claude-code-action` and with plain `claude -p`, lint both, check them against the org Actions policy on a real PR, and run the model part locally because the lab org holds no model key.
Learning Objectives
- Split an AI review workflow into a read-only job that holds the model key and a job that posts the result without a key
- Limit the model to read-only tools with `--tools` or `--allowedTools` plus `--permission-mode default`, and explain why auto mode is not a tool list
- Pass model output to later steps without letting it reach a shell
- Explain what happens to the review on fork PRs, Dependabot PRs and same-repo PRs, and who can steal the key
- Cap cost and runtime with `--max-turns`, `--max-budget-usd`, `timeout-minutes` and `concurrency`
This lesson is for enrolled learners
Log in, then enroll to read the full lesson, run its lab and take the quiz.
