{"modulePath":"github.com/DomBlack/git-stack","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github implements forge.Forge with the gh CLI.\n\n## Types\n\n```go\ntype Forge struct {\n\t// contains filtered or unexported fields\n}\n```\nForge talks to GitHub through gh.\n\n```go\nfunc New(r exec.Runner) *Forge\n```\nNew returns a Forge using r to run gh.\n\n```go\nfunc (f *Forge) Checks(ctx context.Context, repo git.Repo, numbers []int) (map[int]forge.CheckSummary, error)\n```\nChecks asks GitHub for the status check rollup of each pull request's head commit in one GraphQL request, with an aliased pullRequest field per number. The repository is the one gh resolves for the checkout ({owner} and {repo}), the same one MergeStack merges in. A pull request with more than checksPageSize checks has the rest read in follow up requests, one per page for all the pull requests that still have more.\n\n```go\nfunc (f *Forge) ClosePR(ctx context.Context, repo git.Repo, number int, comment string) error\n```\nClosePR closes a pull request with a comment, through gh pr close. gh refuses one that is already closed or merged, which counts as done.\n\n```go\nfunc (f *Forge) CreatePR(ctx context.Context, repo git.Repo, in forge.CreatePR) (forge.PullRequest, error)\n```\nCreatePR opens a pull request and returns it.\n\n```go\nfunc (f *Forge) CreateStack(ctx context.Context, repo git.Repo, numbers []int) (forge.StackRef, error)\n```\nCreateStack groups pull requests into a new stack on GitHub, bottom to top. The id is kept as its decimal string, the form gh stack records.\n\n```go\nfunc (f *Forge) ListPRs(ctx context.Context, repo git.Repo) ([]forge.PullRequest, error)\n```\nListPRs returns every pull request of the repository whose head branch lives in this repository (forks are skipped), newest first as gh orders.\n\n```go\nfunc (f *Forge) MergeStack(ctx context.Context, repo git.Repo, number int, method forge.MergeMethod) (forge.MergeOutcome, error)\n```\nMergeStack merges a pull request and every open pull request below it in its stack through GitHub's asynchronous merge endpoint, the only one that accepts stacked pull requests, and polls until it settles.\n\n```go\nfunc (f *Forge) OpenPRFor(ctx context.Context, repo git.Repo, branch string) (forge.PullRequest, bool, error)\n```\nOpenPRFor asks gh for the open pull requests with branch as their head, so it isn't limited to the newest ones the way ListPRs is.\n\n```go\nfunc (f *Forge) PR(ctx context.Context, repo git.Repo, number int) (forge.PullRequest, error)\n```\nPR looks up pull request number through gh pr view.\n\n```go\nfunc (f *Forge) PullRequestURL(ctx context.Context, repo git.Repo, number int) (string, error)\n```\nPullRequestURL builds https://\\\u003chost\u003e/\\\u003cowner\u003e/\\\u003crepo\u003e/pull/\\\u003cnumber\u003e from the repository's remotes, picking the repository the way gh does: the one \\`gh repo set-default\\` chose (remote.\\\u003cname\u003e.gh-resolved is \"base\" for that remote's own repository, or an explicit OWNER/REPO on that remote's host, e.g. the upstream when only a fork is a remote), then upstream, github, origin, then the first remote. Remote URLs are resolved the way git resolves them (url.\\\u003cbase\u003e.insteadOf applies), and nothing but local git config is read.\n\n```go\nfunc (f *Forge) RenameBranch(ctx context.Context, repo git.Repo, from, to string) error\n```\nRenameBranch renames a branch through GitHub's branch rename endpoint, which moves its open pull request with it and retargets the ones based on it.\n\n```go\nfunc (f *Forge) UpdatePR(ctx context.Context, repo git.Repo, number int, in forge.UpdatePR) error\n```\nUpdatePR edits title, body and base, and can mark a draft ready.\n\n","path":"github.com/DomBlack/git-stack/pkg/forge/github","name":"github","synopsis":"Package github implements forge.Forge with the gh CLI.","isRedistributable":true}
