OpenAI reviewer + Actions bundle: for
gpt-4o-miniand the copy-paste workflow in the same tree, useexamples/pr-review-github-actions/. This directory keeps a mock default model for deterministic CI and integration tests.
This example wires Phase B + C of the GitHub integration:
- Read:
pull_request.getandpull_request.diffagainst the GitHub REST API. - Review: structured mock model output validated by JSON Schema.
- Write:
pull_request.post_commentperforms a realPOST …/issues/{n}/commentswhenowner,repo,number, andbodyare set andGITHUB_TOKENis present; otherwise it stays simulated (as inexamples/pr-review-demo). The comment step remains policy-gated unless you pass--approve tool.github.pull_request.post_comment.
GITHUB_TOKENwith at leastpull_requests: readfor the read steps, andpull_requests: write(orrepo) if you intend to approve the comment step and post for real.- Network access to
GITHUB_API_URL(defaulthttps://api.github.com).
JSON object:
| Field | Meaning |
|---|---|
owner |
Repository owner (user or org) |
repo |
Repository name |
number |
Pull request number |
See fixtures/sample-input.json (fake org/repo for integration tests only).
From the repository root:
export GITHUB_TOKEN=ghp_...
agentctl validate --project examples/pr-review-github
agentctl plan --project examples/pr-review-github --state /tmp/pr-github.db
agentctl apply --project examples/pr-review-github --state /tmp/pr-github.db --auto-approve
agentctl run workflow/pr-review-github \
--project examples/pr-review-github \
--state /tmp/pr-github.db \
--input '{"owner":"YOUR_ORG","repo":"YOUR_REPO","number":123}'Without --approve tool.github.pull_request.post_comment, the final step is blocked by policy
(exit code 5), by design.
To publish the review comment (after policy review of your YAML / process):
agentctl run workflow/pr-review-github \
--project examples/pr-review-github \
--state /tmp/pr-github.db \
--input '{"owner":"YOUR_ORG","repo":"YOUR_REPO","number":123}' \
--approve tool.github.pull_request.post_commentgo test ./test/integration/... starts an HTTP stub and sets GITHUB_API_URL so the workflow runs
without touching GitHub, including an approved run that exercises the live comment POST path.
See examples/pr-review-github-actions/ and the PR workflow .github/workflows/agentctl-pr-review.yml (optional manual publish: agentctl-pr-review-publish.yml). docs/GITHUB_ACTIONS.md covers exit code 5, permissions, and fork PR notes.