Documentation
¶
Overview ¶
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. It tells a missing or unauthenticated gh, and a repo with no GitHub remote, apart from an answer of "not found".
Index ¶
- type Client
- func (c *Client) ChangeLogins(ids []string) (map[string]string, error)
- func (c *Client) ChangePR(change string) (forge.PR, bool, error)
- func (c *Client) CreatePR(head, base, title, body string) (n int, url string, err error)
- func (c *Client) EditPR(n int, body string) error
- func (c *Client) Login() (string, error)
- func (c *Client) MergedPRs(since time.Time, max int) ([]forge.PR, bool, error)
- func (c *Client) MergedPage(since time.Time, cursor string) (forge.Page, error)
- func (c *Client) Name() string
- func (c *Client) OpenPR(head string) (n int, url string, ok bool, err error)
- func (c *Client) PRExists(n int) (bool, error)
- type Error
- type Runner
- type StdinRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads GitHub for the repo in its directory.
func NewWithRunner ¶
NewWithRunner 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.
func NewWithStdinRunner ¶
func NewWithStdinRunner(dir string, r StdinRunner) *Client
NewWithStdinRunner returns a Client that uses r instead of gh, and gives r what gh would read on stdin.
func (*Client) ChangeLogins ¶
ChangeLogins 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.
func (*Client) ChangePR ¶
ChangePR 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.
func (*Client) CreatePR ¶
CreatePR opens a PR from branch head into branch base, with body on gh's stdin. It returns the new PR's number and URL.
func (*Client) Login ¶
Login 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.
func (*Client) MergedPRs ¶
MergedPRs 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. It asks MergedPage page after page and never waits: a rate limit comes back as its *forge.RateLimit.
func (*Client) MergedPage ¶ added in v0.0.22
MergedPage returns one page of the PRs merged at or after since, starting at cursor ("" for the first page), in GitHub's order: most recently updated first. GitHub orders pages by update time, and a PR merged after since was updated after it, so Next is "" at the first page that reaches back past since, at an empty page and at the last page. A rate limit, whether GitHub names it in the response or gh names it on stderr, is a *forge.RateLimit; MergedPage never waits or retries.