Documentation
¶
Overview ¶
Package github adapts GitHub repositories and pull requests to forge contracts.
It uses go-github for tag and release catalogs, repository metadata, and pull request observation and writes. The shared internal/github client supplies authentication and transport policy; upstream and publish interpret the observations for a contribution.
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, input forge.PullRequestInput) (forge.PullRequestObservation, error)
- func (c *Client) Document(ctx context.Context, address string, headers http.Header) ([]byte, bool, error)
- func (c *Client) Find(ctx context.Context, q forge.PullRequestQuery) (forge.PullRequestObservation, error)
- func (c *Client) Inspect(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestStatus, error)
- func (c *Client) MarkReady(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestObservation, error)
- func (c *Client) Name() string
- func (c *Client) NameFromRemote(remote string) (string, error)
- func (c *Client) Observe(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestObservation, error)
- func (c *Client) OpenPullRequests(ctx context.Context, repository, port string) ([]forge.PullRequestSummary, error)
- func (c *Client) Permission(ctx context.Context, repository, login string) (string, error)
- func (c *Client) PostReview(ctx context.Context, input forge.ReviewInput) (string, error)
- func (c *Client) Repository(instance, name string) (forge.Repository, error)
- func (c *Client) RepositoryInfo(ctx context.Context, name string) (forge.RepositoryInfo, error)
- func (c *Client) RequestReviewers(ctx context.Context, ref forge.PullRequestRef, logins []string) error
- func (c *Client) Update(ctx context.Context, input forge.PullRequestInput) (forge.PullRequestObservation, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*githubapi.Client
// GitExecutable reads tags with plain git when the API cannot; empty
// finds git on PATH.
GitExecutable string
}
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, input forge.PullRequestInput) (forge.PullRequestObservation, error)
func (*Client) Document ¶
func (c *Client) Document(ctx context.Context, address string, headers http.Header) ([]byte, bool, error)
Document fetches a livecheck URL on the GitHub API through the client, so the user's credentials and the rate-limit handling apply, sending the caller's headers, which are Base's curl fetch's, in place of the SDK's user agent, Accept, and API version. The API lays its JSON out by those headers, and the maintainers' expressions are written against the indented form MacPorts receives; the SDK's own headers get the compact form. A URL off the API is not served. The body is bounded like a plain listing.
func (*Client) Find ¶
func (c *Client) Find(ctx context.Context, q forge.PullRequestQuery) (forge.PullRequestObservation, error)
func (*Client) Inspect ¶
func (c *Client) Inspect(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestStatus, error)
Inspect reports mergeability, the latest review from each reviewer, check runs, and commit statuses for the pull request's current head. It reads only; nothing here reruns, comments, or merges.
func (*Client) MarkReady ¶
func (c *Client) MarkReady(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestObservation, error)
MarkReady takes a draft pull request out of draft, so it is ready for review, and reports it as it then is. One already ready is left alone.
func (*Client) NameFromRemote ¶
NameFromRemote is the repository a remote's URL names on GitHub.
func (*Client) Observe ¶
func (c *Client) Observe(ctx context.Context, ref forge.PullRequestRef) (forge.PullRequestObservation, error)
func (*Client) OpenPullRequests ¶
func (c *Client) OpenPullRequests(ctx context.Context, repository, port string) ([]forge.PullRequestSummary, error)
OpenPullRequests finds a repository's open pull requests whose titles name a port the way a MacPorts subject does, "port:" or "port,".
func (*Client) Permission ¶
Permission is a person's role on a repository: admin, maintain, write, triage, read, or none.
func (*Client) PostReview ¶
PostReview posts a review on a pull request at the commit it reviewed, and returns the review's address.
func (*Client) Repository ¶
func (c *Client) Repository(instance, name string) (forge.Repository, error)
Repository validates a GitHub owner/name without making a network request.
func (*Client) RepositoryInfo ¶
func (*Client) RequestReviewers ¶
func (c *Client) RequestReviewers(ctx context.Context, ref forge.PullRequestRef, logins []string) error
RequestReviewers asks people to review a pull request again, as GitHub's "re-request review" does.
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, input forge.PullRequestInput) (forge.PullRequestObservation, error)