github

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Start(ctx context.Context) error
	Stop() error

	// Connection status.
	IsConnected() bool
	ConnectionError() string

	// Runners.
	ListOrgRunners(ctx context.Context, org string) ([]*Runner, error)
	ListRepoRunners(ctx context.Context, owner, repo string) ([]*Runner, error)

	// Workflows.
	TriggerWorkflowDispatch(
		ctx context.Context,
		owner, repo, workflowID, ref string,
		inputs map[string]string,
	) error
	GetWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, error)
	ListWorkflowRuns(ctx context.Context, owner, repo, workflowID string, opts ListWorkflowRunsOpts) ([]*WorkflowRun, error)
	ListWorkflowRunJobs(ctx context.Context, owner, repo string, runID int64) ([]*WorkflowJob, error)
	CancelWorkflowRun(ctx context.Context, owner, repo string, runID int64) error

	// Rate limiting.
	RateLimitRemaining() int
	RateLimitReset() time.Time
}

Client defines the interface for GitHub API operations.

func NewClient

func NewClient(log logrus.FieldLogger, token string) Client

NewClient creates a new GitHub client.

type ListWorkflowRunsOpts

type ListWorkflowRunsOpts struct {
	Branch    string
	Event     string
	Status    string
	CreatedAt *time.Time
	PerPage   int
}

ListWorkflowRunsOpts contains options for listing workflow runs.

type Metrics

type Metrics interface {
	SetGitHubRateLimit(remaining float64)
}

Metrics interface for rate limit tracking.

type Poller

type Poller interface {
	Start(ctx context.Context) error
	Stop() error
	ForceRefresh(ctx context.Context) error
	SetRunnerChangeCallback(cb RunnerChangeCallback)
}

Poller periodically fetches runner status from GitHub.

func NewPoller

func NewPoller(
	log logrus.FieldLogger,
	cfg *config.Config,
	client Client,
	st store.Store,
	m Metrics,
) Poller

NewPoller creates a new runner poller.

type Runner

type Runner struct {
	ID     int64
	Name   string
	OS     string
	Status string // online, offline
	Busy   bool
	Labels []string
}

Runner represents a GitHub Actions runner.

type RunnerChangeCallback

type RunnerChangeCallback func(runner *store.Runner)

RunnerChangeCallback is called when runner status changes.

type WorkflowJob

type WorkflowJob struct {
	ID         int64
	Name       string
	Status     string // queued, in_progress, completed
	Conclusion string // success, failure, cancelled, etc.
	RunnerID   int64
	RunnerName string
	StartedAt  time.Time
}

WorkflowJob represents a job within a GitHub Actions workflow run.

type WorkflowRun

type WorkflowRun struct {
	ID         int64
	Name       string
	Status     string // queued, in_progress, completed
	Conclusion string // success, failure, cancelled, etc.
	HTMLURL    string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

WorkflowRun represents a GitHub Actions workflow run.

Jump to

Keyboard shortcuts

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