github

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 12 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

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("file not found")

ErrNotFound reports a confirmed absence: both the raw content host and the Contents API answered 404 for the path at the ref. Any other failure (5xx, 403/rate limit, timeout, cancellation) is not ErrNotFound - it says nothing about whether the file exists.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client for the GitHub API using go-github

func New

func New(httpClient *http.Client) *Client

New creates a new GitHub client with optional authentication If httpClient is nil, a default HTTP client will be used If authentication is configured via GITHUB_TOKEN, the client's transport is wrapped with oauth2's token-injecting RoundTripper.

func (*Client) GetCommitForTag

func (c *Client) GetCommitForTag(ctx context.Context, owner, repo, tag string) (string, error)

GetCommitForTag gets the commit SHA for a specific tag

func (*Client) GetFirstValidRelease

func (c *Client) GetFirstValidRelease(ctx context.Context, owner, repo string, filter types.VersionFilterFunc) (string, error)

GetFirstValidRelease finds the first release (newest first, up to 500 releases) that passes filter

func (*Client) GetFirstValidTag

func (c *Client) GetFirstValidTag(ctx context.Context, owner, repo string, filter types.VersionFilterFunc) (string, error)

GetFirstValidTag finds the first tag (newest first, up to 1000 tags) that passes filter

type Repository

type Repository struct {
	Owner string
	Name  string
}

Repository represents basic repository information

func ParseRepository

func ParseRepository(identifier string) (*Repository, error)

ParseRepository parses a repository identifier like "golang/go" into owner and repo

type Searcher added in v0.3.0

type Searcher struct {
	// contains filtered or unexported fields
}

Searcher adapts CHOAM's GitHub access to omnibump's remote.GitHubSearcher interface (GetFileContent + ListFilePaths), so that omnibump's remote fetcher can retrieve go.mod/go.sum files without checking out the repository.

GetFileContent prefers the unauthenticated raw.githubusercontent.com fast path (which avoids consuming GitHub API rate limit for public repositories) and falls back to the authenticated Contents API for private repositories.

func NewSearcher added in v0.3.0

func NewSearcher(httpClient *http.Client) *Searcher

NewSearcher creates a Searcher. The provided httpClient is used both to build the (optionally token-authenticated) go-github client and for raw content fetches; if nil, http.DefaultClient is used for raw fetches.

func (*Searcher) GetFileContent added in v0.3.0

func (s *Searcher) GetFileContent(ctx context.Context, owner, repo, path, ref string) ([]byte, error)

GetFileContent fetches the content of a file at a specific ref, trying the raw content host first and falling back to the authenticated Contents API.

func (*Searcher) ListFilePaths added in v0.3.0

func (s *Searcher) ListFilePaths(ctx context.Context, owner, repo, ref string) ([]string, error)

ListFilePaths returns all blob paths in a repository at the given ref using the Git Tree API. It is provided to satisfy the remote.GitHubSearcher interface; CHOAM fetches known modroots directly and does not rely on it.

Jump to

Keyboard shortcuts

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