https://github.com/bborbe/github-pr-review-agent
GitHub PR review agent — extracted from bborbe/maintainer. Reviews PRs via the agent framework; published image docker.io/bborbe/github-pr-review-agent.
https://github.com/bborbe/github-pr-review-agent
Last synced: 1 day ago
JSON representation
GitHub PR review agent — extracted from bborbe/maintainer. Reviews PRs via the agent framework; published image docker.io/bborbe/github-pr-review-agent.
- Host: GitHub
- URL: https://github.com/bborbe/github-pr-review-agent
- Owner: bborbe
- License: bsd-2-clause
- Created: 2026-07-04T21:35:02.000Z (17 days ago)
- Default Branch: master
- Last Pushed: 2026-07-16T14:07:08.000Z (5 days ago)
- Last Synced: 2026-07-20T08:32:14.687Z (1 day ago)
- Language: Go
- Size: 313 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# github-pr-review-agent
Autonomous GitHub / Bitbucket **PR review agent**. Given a PR URL it clones the
repo, runs a Claude Code review inside a `claude-yolo` container, and posts the
result back as a PR review with a verdict (`approve` / `request-changes`).
Part of the `bborbe` agent-maintenance fleet: the shared library lives in
[`bborbe/maintainer`](https://github.com/bborbe/maintainer) (imported as
`github.com/bborbe/maintainer`), the Helm chart ships there too, and the
published image is `docker.io/bborbe/github-pr-review-agent`. Extracted from the
former `bborbe/maintainer` monorepo (`agent/pr-reviewer`).
## How it works
1. Parse the PR URL → platform (GitHub / Bitbucket), owner, repo, PR number.
2. Fetch PR metadata (source + target branch) via the platform REST API.
3. Clone the repo at the PR head into a scratch dir.
4. Run the Claude Code review (`/pr-review `) inside the
`claude-yolo` container against the diff.
5. Parse the JSON verdict from the review output.
6. Post a structured review — `APPROVE` / `REQUEST_CHANGES` (gated by
`autoApprove`) or a plain `COMMENT` — and clean up the clone.
## Run modes
| Mode | Entry | Use |
|---|---|---|
| Kubernetes Job | `main.go` (`/main` in the image) | Env-driven; spawned by the agent-task-executor from a Kafka task. This is how it runs in production. |
| Local CLI | `cmd/run-task` | Takes a PR URL as a positional arg; flag-based config. For local runs / debugging. |
```bash
go run ./cmd/run-task https://github.com/owner/repo/pull/42
go run ./cmd/run-task -v --comment-only https://github.com/owner/repo/pull/42
```
## Configuration
Env-driven (Kubernetes) — key variables:
| Var | Purpose |
|---|---|
| `APP_ID` / `INSTALLATION_ID` | GitHub App identity (`Ben's Pull Request Reviewer`) |
| `PEM_KEY` | GitHub App private key (mounted from a Secret) |
| `REPO_ALLOWLIST` | Repos the agent may review (e.g. `github.com/bborbe/*,!github.com/bborbe/go-skeleton`) |
| `BOT_GITHUB_LOGIN` | The App's bot login, used to detect its own prior reviews |
| `REVIEW_MODE` | Review depth (e.g. `selector`) |
| `BITBUCKET_TOKEN` | Bitbucket Server bearer token (Bitbucket PRs only) |
Per-repo behavior is driven by the target repo's `.maintainer.yaml`
(`prReviewer.autoApprove`) — read from the PR head. See
[`bborbe/maintainer`](https://github.com/bborbe/maintainer) for that schema.
## Verdict contract
The Claude Code review must emit a JSON block:
```json
{"verdict": "approve|request-changes", "reason": ""}
```
Fallback: a heuristic section-header scan (`## Must Fix`, `## Blocking`).
Horizontal rules (`---`) are not treated as must-fix content.
## Smoke-test PR
**https://github.com/bborbe/maintainer/pull/2** — `test: delete-this-pr-never`.
Permanent test fixture (trivial diff). Use it for any local or k8s smoke test.
**Do not close, do not merge.**
## Layout
```
. lib imported from github.com/bborbe/maintainer
├── main.go Kubernetes Job entry (env-driven; /main in the image)
├── cmd/
│ ├── run-task/ local CLI (PR URL as positional arg)
│ ├── cli/ supporting CLI
│ └── mint-iat/ GitHub App installation-token smoke tool
├── pkg/ URL parse, config, git clone, GitHub/Bitbucket clients,
│ App auth, review runner, verdict parser, posters
├── docs/ architecture.md · github-app-setup.md · pr-post-back.md
└── helm chart + shared lib live in bborbe/maintainer
```
See [`docs/architecture.md`](docs/architecture.md) for the three-phase design
(planning → execution → review) and the verdict rubric, and
[`docs/github-app-setup.md`](docs/github-app-setup.md) for the App auth flow.
## Build
```bash
make precommit # fmt, generate, test, lint, vet, vuln, license
VERSION=vX.Y.Z make buca # build + push docker.io/bborbe/github-pr-review-agent:vX.Y.Z
```