github

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package github implements providers.Provider for GitHub Actions.

This is a thin adapter around the existing pkg/github.Client, translating its types into the provider-neutral interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements providers.Poll and providers.Webhook for GitHub Actions.

func New

func New(client *github.Client, log *slog.Logger, linuxImage, windowsImage string) *Provider

New creates a GitHub provider wrapping an existing GitHub client. linuxImage / windowsImage, if non-empty, override the runner container image for the corresponding job OS. Empty values defer to the built-in Linux default and (for Windows) the runtime's host-matched servercore fallback.

func (*Provider) CatchUpPoll

func (p *Provider) CatchUpPoll(ctx context.Context) error

CatchUpPoll fires a single poll to discover jobs queued while ephemerd was offline. Used in webhook mode (where continuous polling is disabled) to catch jobs that transitioned to "queued" before webhooks could be registered — webhook events aren't replayed for jobs already in that state.

func (*Provider) ClaimJob

func (p *Provider) ClaimJob(ctx context.Context, event *providers.JobEvent, runnerName string, labels []string) (*providers.Claim, error)

func (*Provider) CleanStaleWebhooks

func (p *Provider) CleanStaleWebhooks(ctx context.Context)

CleanStaleWebhooks removes any workflow_job webhooks left behind by previous ephemerd instances that crashed or were killed without cleanup. Called on startup before registering new webhooks to avoid hitting GitHub's 20-hook limit.

func (*Provider) DefaultImage

func (p *Provider) DefaultImage() string

DefaultImage returns the Linux runner image (legacy alias for the scheduler's per-OS resolution). New callers should use DefaultImageFor.

func (*Provider) DefaultImageFor

func (p *Provider) DefaultImageFor(os string) string

func (*Provider) DefaultJobImage

func (p *Provider) DefaultJobImage() string

func (*Provider) DeregisterWebhooks

func (p *Provider) DeregisterWebhooks(ctx context.Context) error

func (*Provider) Events

func (p *Provider) Events() <-chan providers.JobEvent

Events exposes the provider's poll-event channel without starting the poll loop. In webhook mode the scheduler never calls Start(), but CatchUpPoll still emits into this channel — the scheduler must drain it or the startup recovery events rot in the channel buffer unobserved.

func (*Provider) FetchJobImage

func (p *Provider) FetchJobImage(ctx context.Context, event *providers.JobEvent) string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) RateSnapshot

func (p *Provider) RateSnapshot() (remaining, limit int64, reset, updated time.Time)

RateSnapshot exposes the underlying GitHub client's last-observed rate-limit state so the scheduler's retry queue can bias backoff: when remaining==0 with a fresh update timestamp and reset > now, the next attempt is snapped just past the reset. Zero values mean "no data yet" (the client has not yet made a request).

func (*Provider) RegisterWebhooks

func (p *Provider) RegisterWebhooks(ctx context.Context, url, secret string) error

func (*Provider) ReleaseJob

func (p *Provider) ReleaseJob(ctx context.Context, claim *providers.Claim) error

func (*Provider) ReportsRunnerNames

func (p *Provider) ReportsRunnerNames() bool

ReportsRunnerNames implements providers.RunnerNameReporter: GitHub workflow_job webhooks carry runner_name on in_progress and completed actions, so the scheduler may key runner teardown and the orphan sweep on observed assignments for runners dispatched via this provider.

func (*Provider) Start

func (p *Provider) Start(ctx context.Context, cfg providers.PollConfig) (<-chan providers.JobEvent, error)

func (*Provider) Stop

func (p *Provider) Stop(ctx context.Context) error

func (*Provider) WebhookHandler

func (p *Provider) WebhookHandler(secret string) (http.Handler, <-chan providers.JobEvent)

Jump to

Keyboard shortcuts

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