{"modulePath":"github.com/dphaener/physa","version":"v0.0.20","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github is the GitHub adapter of the forge interface: it reads GitHub through the gh command, and opens or refreshes a PR only through the forge.PRs methods in pulls.go; it never merges. It tells a missing or unauthenticated gh, and a repo with no GitHub remote, apart from an answer of \"not found\".\n\n## Types\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient reads GitHub for the repo in its directory.\n\n```go\nfunc New(dir string) *Client\n```\nNew returns a Client that runs the real gh in dir.\n\n```go\nfunc NewWithRunner(dir string, r Runner) *Client\n```\nNewWithRunner returns a Client that uses r instead of gh. r is not given the body of a PR, so it suits the reads; see NewWithStdinRunner.\n\n```go\nfunc NewWithStdinRunner(dir string, r StdinRunner) *Client\n```\nNewWithStdinRunner returns a Client that uses r instead of gh, and gives r what gh would read on stdin.\n\n```go\nfunc (c *Client) ChangeLogins(ids []string) (map[string]string, error)\n```\nChangeLogins asks GitHub, 100 changes a query, for each change's author's login. A change GitHub does not know, or whose author has no account, is left out.\n\n```go\nfunc (c *Client) ChangePR(change string) (forge.PR, bool, error)\n```\nChangePR returns the PR change came from, with its people's review and discussion and its commits, oldest first. Its bool is false when change came from no PR or GitHub does not know it. Reviews still pending are left out: only their author can see them.\n\n```go\nfunc (c *Client) CreatePR(head, base, title, body string) (n int, url string, err error)\n```\nCreatePR opens a PR from branch head into branch base, with body on gh's stdin. It returns the new PR's number and URL.\n\n```go\nfunc (c *Client) EditPR(n int, body string) error\n```\nEditPR replaces the body of PR n, with the body on gh's stdin.\n\n```go\nfunc (c *Client) Login() (string, error)\n```\nLogin returns the login of the GitHub account gh is signed in as. It is not part of forge.Forge: only the person running Physa needs it. Failures are classed as gh's others are, so a missing gh is forge.ErrUnavailable and a signed-out one forge.ErrUnauthenticated.\n\n```go\nfunc (c *Client) MergedPRs(since time.Time, max int) ([]forge.PR, bool, error)\n```\nMergedPRs returns the PRs merged at or after since, newest merge first, at most max, with their people's review and the issues they close. more is true when max stopped the list before since did. A max below 1 returns nothing. GitHub orders pages by update time, and a PR merged after since was updated after it, so paging stops at the first page that reaches back past since.\n\n```go\nfunc (c *Client) Name() string\n```\nName is \"github\".\n\n```go\nfunc (c *Client) OpenPR(head string) (n int, url string, ok bool, err error)\n```\nOpenPR returns the open PR whose head is the branch head. Its bool is false when none is open.\n\n```go\nfunc (c *Client) PRExists(n int) (bool, error)\n```\nPRExists reports whether the repo has a pull request numbered n.\n\n```go\ntype Error struct {\n\tArgs     []string\n\tStderr   string\n\tExitCode int\n}\n```\nError is a gh command that exited non-zero.\n\n```go\nfunc (e *Error) Error() string\n```\n\n```go\ntype Runner func(dir string, args ...string) (stdout []byte, err error)\n```\nRunner runs gh with args in dir and returns its stdout, also when gh exits non-zero (gh api prints GraphQL errors there).\n\n```go\ntype StdinRunner func(dir string, stdin []byte, args ...string) (stdout []byte, err error)\n```\nStdinRunner is a Runner that also passes stdin to gh when it is not nil.\n\n","path":"github.com/dphaener/physa/internal/forge/github","name":"github","synopsis":"Package github is the GitHub adapter of the forge interface: it reads GitHub through the gh command, and opens or refreshes a PR only through the forge.PRs methods in pulls.go; it never merges.","isRedistributable":true}
