github

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*githubapi.Client
	// Git reads tags with plain git when the API cannot.
	Git git.Program
}

func (*Client) Create

func (*Client) Describe added in v0.5.0

func (c *Client) Describe(ctx context.Context, instance, name string) (forge.Description, error)

Describe reads a repository's description, by its owner/name, as the repository it binds says it (repository.Describe).

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) FailedJobs added in v0.5.0

func (c *Client) FailedJobs(ctx context.Context, repository, head string) ([]forge.CIJob, error)

FailedJobs are a head's GitHub Actions jobs that failed, of each run's latest attempt, through the documented endpoints: the repository's workflow runs for the head, and each run's jobs. It reads only.

func (*Client) Inspect

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) JobLog added in v0.5.0

func (c *Client) JobLog(ctx context.Context, repository string, job int64) ([]byte, error)

JobLog is a job's log, through its documented link ("Download job logs for a workflow run"), which redirects to where it's served, fetched as fetch fetches; each line without the time GitHub writes before it. One GitHub no longer keeps, or won't give this login, is forge.ErrNotFound.

func (*Client) Login added in v0.4.0

func (c *Client) Login(ctx context.Context) (forge.Login, error)

Login is who the client acts as, asked of GitHub, and where its token comes from (githubapi.Client.LoginStatus).

func (*Client) MarkReady

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

func (c *Client) NameFromRemote(remote string) (string, error)

NameFromRemote is the repository a remote's URL names on GitHub.

func (*Client) Observe

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 contain a word, as GitHub's search reads it; which of them name a port is MacPorts' subject rule, the caller's (commitmsg.SubjectPorts; the architecture review's H2).

func (*Client) Permission

func (c *Client) Permission(ctx context.Context, repository, login string) (string, error)

Permission is a person's role on a repository: admin, maintain, write, triage, read, or none.

func (*Client) PostReview

func (c *Client) PostReview(ctx context.Context, input forge.ReviewInput) (string, error)

PostReview posts a review on a pull request at the commit it reviewed, and returns the review's address.

func (*Client) ReadPullRequests added in v0.4.0

func (c *Client) ReadPullRequests(ctx context.Context, refs []forge.PullRequestRef) ([]forge.PullRequestReading, error)

ReadPullRequests reads the pull requests with GitHub's GraphQL API, twenty-five a request, where Observe and Inspect take about five requests each: the pull-request half of spending less of GitHub's allowance (the SQL study's O8). One GitHub hasn't is not Found; one with more reviews or checks than a reading takes is Partial.

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 (c *Client) RepositoryInfo(ctx context.Context, name string) (forge.RepositoryInfo, error)

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) RerunFailed added in v0.5.0

func (c *Client) RerunFailed(ctx context.Context, repository string, run int64) error

RerunFailed runs a workflow run's failed jobs again, as the person whose login it is, through the documented endpoint ("Re-run failed jobs from a workflow run"), which needs write access to the repository: without it GitHub answers 403 or 404, which is forge.ErrRejected.

func (*Client) Update

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL