vcs-github — automate GitHub from Rust
Part of the vcs-toolkit-rs workspace.
What you can do: check auth, view the repo, run the full pull-request lifecycle
(list/view/create/merge/mark-ready/close, review/comment, CI checks, feedback),
manage issues and releases, and list/view/watch GitHub Actions runs — all as typed
async methods over the gh CLI, behind a mockable interface.
How it works: each call runs the real gh (its own auth and host resolution)
and deserializes its --json output into structs — nothing scrapes human-readable
text. Commands run inside an OS job (an OS-level container that kills the whole
process tree if your program exits, via processkit) so no gh subprocess is
ever orphaned; calls return the structured Error and honour an optional timeout.
Credentials: gh's ambient login by default; to supply a token per operation
(CI, vault, multi-account), the one-liner is GitHub::new().with_token(tok) (or
.with_env_token("MY_TOKEN")); for full control attach a CredentialProvider with
.with_credentials(...). Either way the token is injected as GH_TOKEN, kept out
of argv.
📖 Full guide: on docs.rs — every command by theme, result types, config types, and worked examples.
Every method is async, so call it from a tokio runtime:
use Path;
use ;
let gh = new;
let prs = gh.pr_list.await?; // Vec<PullRequest>
let authed = gh.auth_status.await?; // bool — true when `gh auth status` exits 0
Inspect the repo and open a PR
use Path;
use ;
# async
auth_status and timeouts
auth_status reports the bool from gh auth status's exit code, but a spawn
failure or a timeout still surfaces as a processkit::Error rather than a
silent false:
# use ;
use Duration;
# async
Consumers depend on the GitHubApi trait and substitute a fake in tests — enable
the mock feature for a mockall-generated MockGitHubApi, or inject a fake
process runner with GitHub::with_runner(processkit::testing::ScriptedRunner::new()…):
use ;
use Path;
use ;
# async
Requires the gh binary on PATH (authenticated via gh auth login).
License
MIT