Pull requests & CI

Open, review, merge, and debug — without a GitHub token in the workspace.

Commands

agentgate pr list
agentgate pr view 42
agentgate pr create --title "Implement the feature" --base main --body-file description.md
agentgate pr comment 42 --body-file note.md
agentgate pr review 42 --body-file note.md
agentgate pr merge 42 --sha 0123456789abcdef0123456789abcdef01234567 --method squash
agentgate ci list --branch agent/my-feature
agentgate ci view 123456789
agentgate ci jobs 123456789
agentgate ci logs 987654321 --output job.log

Commands infer OWNER/REPO from origin or accept --repo. PRs are drafts unless --ready. Output is JSON, except ci logs.

Creating PRs

github.pr.create can require approval. The grant binds repository, head/base branches, title, body, draft status, runtime, and policy — but not the head commit, since GitHub creates the PR from the branch's current state. Gate pushes separately when commit-level review matters.

Reviews and comments

pr review always submits a COMMENT review. Agents can't approve or request changes through the broker. Comment and review text is never logged — only its length.

Merging

github.pr.merge rules can only be approval or deny; every merge needs a human.

{ "id": "merge-main", "action": "github.pr.merge", "repository": "acme/demo",
  "ref": "refs/heads/main", "effect": "approval", "approvals": 2,
  "reviewerSources": ["oidc"], "mergeMethods": ["squash"] }

The merge is pinned to the reviewed head:

  • The PR must be open, not a draft, and its head must equal --sha (PR_NOT_MERGEABLE, HEAD_MOVED).
  • Approvals bind PR number, head SHA, base branch, method, head repository, runtime, and policy.
  • Immediately before merging, the broker re-reads the PR and aborts on 409 BASE_CHANGED or 409 HEAD_MOVED.
  • GitHub receives only { sha, merge_method } — never an agent-written commit message.

Fork pull requests

Configure the fork with forkOf, allow git.read on it, and add a rule with headRepository:

{ "name": "agent-bot/demo", "id": 9, "installationId": 3, "forkOf": "acme/demo" }
{ "id": "fork-pr", "action": "github.pr.create", "repository": "acme/demo",
  "ref": "refs/heads/agent/*", "headRepository": "agent-bot/demo", "effect": "approval" }
agentgate pr create --title "…" --base main --upstream acme/demo

Warning

Rules without headRepository match same-repository heads only — including deny rules. Add explicit fork rules (for example "headRepository": "*") for every restriction that should also cover forks.

CI logs

ci logs follows GitHub's redirect without attaching any credential, only to the known log storage host family. Logs are capped at 64 MiB; --output writes with mode 0600 and never leaves a partial file.

Git LFS

The broker answers the LFS batch API. Downloads follow git.read; uploads need an explicit git.lfs.upload rule. Storage hrefs are rewritten to single-use, 15-minute broker URLs, and every byte is SHA-256-verified — the final byte is withheld until it matches.