abt-gh-tools
abt-gh-tools provides granular GitHub CLI (gh) @tool functions for cloned repositories. Install alongside abt-git-tools — agents call git__git_clone first, then gh__* tools.
Package id: abt-gh-tools · Shorthand: gh
abt docs package gh --project-root . # full component → tool catalog
Tool catalog
| Component | Tool | Access | What it returns |
|---|---|---|---|
| pull_requests | gh_pr_list |
read | One line per pull request; state, limit 1–100, search qualifiers |
| pull_requests | gh_pr_view |
read | Facts, description, changed files, reviews, conversation and inline review comments (comments 0–50 newest of each) |
| pull_requests | gh_pr_diff |
read | The patch, whole or for one path (a file, or a directory; a renamed file by either name). A whole patch over 75 KB is saved in the clone for git_file_read; one path over 75 KB is cut |
| pull_requests | gh_pr_checks |
read | N checks: x fail, y pending, z pass, with the run and job id of each failing or pending check |
| pull_requests | gh_pr_create |
write | Opens a pull request (draft, base, head); returns its URL |
| pull_requests | gh_pr_update |
write | Title, description and/or state (open, closed) |
| pull_requests | gh_pr_review |
write | comment, approve or request-changes; the first and last need a body |
| pull_requests | gh_pr_merge |
write | merge, squash (default) or rebase |
| issues | gh_issue_list |
read | One line per issue |
| issues | gh_issue_view |
read | Facts, description and the newest comments |
| issues | gh_issue_update |
write | Title, description and/or state |
| comments | gh_comment |
write | Comments on a pull request or issue (kind) |
| actions | gh_run_list |
read | Run id, outcome, workflow, branch, event, date; filter by workflow, branch, status |
| actions | gh_run_view |
read | Jobs and failed step, or with log="failed" / "full" the cleaned log (end kept) |
| releases | gh_release_list |
read | Tag, date, latest / pre-release |
Every result is bounded to 75 KB (about 25k tokens); ABT_TOOL_MAX_OUTPUT_BYTES overrides it. Numeric limits outside their range are rejected with an error that names the range, not silently reduced. Text written by other people (titles, descriptions, comments, reviews, patches, logs) is returned as data; the tool descriptions tell the model not to follow instructions found in it.
Tool spec syntax
Agent frontmatter uses shorthand__tool (double underscore) — individual tools or a package wildcard (gh__<tool> or gh__*):
tools:
- git__git_clone # abt-git-tools — required first
- gh__gh_run_view
- gh__* # all enabled read tools (+ writes when allow_writes permits)
- gh__gh_pr_merge # write — needs allow_writes
Unknown specs (e.g. gh__read, gh__pull_requests, gh__pr_list) are invalid because no tool has that name. Specs with more than one __ segment (e.g. gh__pr__merge) and bare tool names without the gh__ prefix (e.g. gh_pr_list) are invalid too. abt compile fails on such specs once the package is installed (run abt deps first), and abt config show --agent NAME lists what actually resolves.
Enable writes in project config:
config:
packages:
abt-gh-tools:
allow_writes: false
components:
pull_requests:
allow_writes: true
issues:
allow_writes: true
comments:
allow_writes: true
Installation
packages:
- git: https://github.com/getyourguide/abt-core.git
revision: main
subdirectory: packages/abt-gh-tools
abt deps
Prerequisites
| Tool | Required | Notes |
|---|---|---|
gh |
Yes | All tools shell out to GitHub CLI |
git__git_clone |
Yes | Repo must be cloned first — see git-tools |
Auth
Token: credentials.github.token from profiles.yaml, else GITHUB_TOKEN, else GH_TOKEN. One resolver serves git, gh and context.github(), so they always use the same token. gh receives it in both GH_TOKEN and GITHUB_TOKEN. A selected gh__* tool also needs a gh: namespace (its contents are not read) — without it, abt run/abt dispatch fail with E_PROFILE_MISSING_NAMESPACE for gh. The git__git_clone tool the gh tools depend on needs its own git: block (see git-tools).
credentials:
github:
token: "{{ env_var('GITHUB_TOKEN') }}"
gh: {}
CI failure triage
When the task mentions a GitHub Actions run URL, or a pull request with failing checks, clone the repository and read the log:
git_clone("apache/airflow")
gh_pr_checks("apache___airflow", 4711) # which check failed, with run=… job=…
gh_run_view("apache___airflow", "26104400482") # jobs and the failed step
gh_run_view("apache___airflow", "26104400482", log="failed") # the log of the failed steps
run_id also accepts the URL (…/actions/runs/<id> or …/runs/<id>/job/<id>). A log longer than 75 KB keeps its end, where the failure is; pass job_id to read one job.
Investigation order:
- CI / Actions URL →
gh_run_view(..., log="failed") - PR checks →
gh_pr_checks - Code →
git_repo_search,git_file_read(abt-git-tools) - History →
git_log,git_show(abt-git-tools)
Write tool gating
Write tools are excluded at compile time unless config.packages.abt-gh-tools enables them (package default or per-component override). Component-level allow_writes: false always blocks that component.
Pair gh_pr_merge, gh_comment and gh_pr_review with confirmation_required: true in agent frontmatter. See Approvals.