github

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 23 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
	// Moves reads where a repository whose tags came from git moved, from
	// GitHub's web page for it; none are read where nil.
	Moves *Moves
}

func (*Client) Account added in v0.7.0

func (c *Client) Account(ctx context.Context, instance, login string) (forge.Account, error)

Account reads a login as GitHub has it now, one request (GET /users/{login}): none where GitHub answers 404, as for a name no one holds.

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) MarkDraft added in v0.7.0

MarkDraft returns a pull request ready for review to draft, and reports it as it then is. One already a draft is left alone.

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) RequestsLeft added in v0.6.0

func (c *Client) RequestsLeft(ctx context.Context) (int, time.Time, error)

RequestsLeft is what's left of the hour's requests for the client's login, or without one, as GitHub says it (forge.AllowanceReader).

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

type Moves added in v0.8.0

type Moves struct {
	// BaseURL is GitHub's web, https://github.com where empty; a test
	// points it at a stub site.
	BaseURL string
	// HTTP sends the reads, which follow no redirect whatever it says;
	// dockhand's own transport where nil.
	HTTP *http.Client
	// contains filtered or unexported fields
}

Moves reads where a repository moved from GitHub's web page for it, which answers a renamed or transferred repository with a 301 naming the new one, as GitHub documents, outside the API's limits and its pacer. GitHub's git serves a moved repository under its old name with no word of the move, so a repository whose tags came from git is asked here: a look's 416 repositories were asked in 26.6 s, eight at once, 20 of them moved, with no throttling (the web redirect's look, 2026-11-01). The page is no API contract, so whatever it doesn't answer as expected is left unsaid, and a 429 or a refusal pauses the reads; nothing waits on it but the note it gives. Each answer is kept seven days, a 200's and a 301's alike, in the process and in a file where one is given, so a daily look asks about sixty and serve's looks no more.

func NewMoves added in v0.8.0

func NewMoves(path string) *Moves

NewMoves keeps the answers in the process, and in the file at path where it isn't empty.

Jump to

Keyboard shortcuts

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