ghclient

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ghclient wraps go-github with token resolution, an 8-way concurrency cap, and in-flight de-duplication/caching for repeated lookups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a concurrency- and cache-aware GitHub API client.

func New

func New(host string) *Client

New constructs a client for the given host, resolving a token if available. host "" or "github.com" uses the public API; any other host is treated as a GitHub Enterprise Server instance (API at https://<host>/api/v3/).

func (*Client) DefaultBranch

func (c *Client) DefaultBranch(owner, repo string) (string, error)

DefaultBranch returns the repo's default branch (e.g. "main").

func (*Client) ListRunJobs

func (c *Client) ListRunJobs(owner, repo string, runID int64) ([]RunJob, error)

ListRunJobs returns the jobs for one workflow run.

func (*Client) ListTags

func (c *Client) ListTags(owner, repo string) ([]string, error)

ListTags returns all tag names for a repo (paginated, cached, deduped).

func (*Client) ListWorkflowRuns

func (c *Client) ListWorkflowRuns(owner, repo string, workflowID int64, branch string, since time.Time) ([]WorkflowRun, error)

ListWorkflowRuns returns a workflow's runs created on or after `since`, newest first (server-side filtered via the API's `created` query).

func (*Client) ListWorkflows

func (c *Client) ListWorkflows(owner, repo string) ([]WorkflowMeta, error)

ListWorkflows lists the repo's workflows.

func (*Client) ResolveSha

func (c *Client) ResolveSha(owner, repo, ref string) (string, error)

ResolveSha resolves a tag/branch/sha to a full commit SHA (cached, deduped).

func (*Client) WarnIfUnauthenticated

func (c *Client) WarnIfUnauthenticated()

WarnIfUnauthenticated prints a rate-limit warning to stderr when no token.

type RunJob

type RunJob struct {
	Name         string
	StartedAt    time.Time
	HasStarted   bool
	CompletedAt  time.Time
	HasCompleted bool
}

RunJob is the subset of a job we need.

type WorkflowMeta

type WorkflowMeta struct {
	ID   int64
	Name string
	Path string
}

WorkflowMeta is the subset of a workflow we need.

type WorkflowRun

type WorkflowRun struct {
	ID            int64
	Status        string
	Conclusion    string
	RunStartedAt  time.Time
	HasRunStarted bool
	UpdatedAt     time.Time
}

WorkflowRun is the subset of a run we need.

Jump to

Keyboard shortcuts

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