githubscheduler

package
v0.266.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 21 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

View Source
const (
	// ArtifactNamePrefix is shared by the rendered upload step and the poller.
	ArtifactNamePrefix = "infer-conversations-"
)
View Source
const (
	// DefaultRepoName is the repository created under the authenticated user
	// when scheduler.github.repository is not configured.
	DefaultRepoName = ".routines"
)

Variables

This section is empty.

Functions

func RenderWorkflow

func RenderWorkflow(job *scheddomain.ScheduledJob, ghCron, defaultModel string, cfg config.SchedulerGitHubConfig) ([]byte, error)

RenderWorkflow renders one job's Actions workflow. ghCron must already be translated via TranslateCron. DefaultModel is used when the job has none.

func ResolveRepo

func ResolveRepo(ctx context.Context, runner githubsetup.CommandRunner, configured string) (string, error)

ResolveRepo returns the configured repository, defaulting to "<authenticated user>/.routines".

func TranslateCron

func TranslateCron(expr string) (string, error)

TranslateCron converts a robfig/cron expression (including @descriptors and @every durations) into a GitHub Actions compatible 5-field UTC cron, or returns an error explaining why the expression cannot be scheduled on GitHub.

func WorkflowPath

func WorkflowPath(jobID string) string

WorkflowPath returns the repo-relative path of a job's workflow file.

Types

type ArtifactPoller

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

ArtifactPoller periodically downloads conversation artifacts uploaded by GitHub-backed job runs into local storage, pausing until pausedUntil after a rate limit. Its lifecycle mirrors the heartbeat service. ponytail: raw jsonl drop only works for storage.type jsonl. Parse and save via ConversationStorage if sqlite or postgres users ask.

func NewArtifactPoller

func NewArtifactPoller(opts ArtifactPollerOptions) (*ArtifactPoller, error)

NewArtifactPoller validates options and constructs a poller.

func (*ArtifactPoller) Start

func (p *ArtifactPoller) Start(ctx context.Context) error

Start launches the ticker goroutine. Calling Start more than once is a no-op.

func (*ArtifactPoller) Stop

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

Stop cancels the ticker and waits for an in-flight tick to finish.

type ArtifactPollerOptions

type ArtifactPollerOptions struct {
	Runner           githubsetup.CommandRunner
	Repo             string
	ConversationsDir string
	ArtifactsDir     string
	StatePath        string
	Interval         time.Duration
	InitialDelay     time.Duration
	MaxAttempts      int
	RateLimitBackoff time.Duration
}

ArtifactPollerOptions bundles dependencies for NewArtifactPoller. Repo is the resolved "<owner>/<name>". Jsonl files go to ConversationsDir and others to ArtifactsDir, skipped when empty. StatePath persists the cursor, and an artifact is skipped after MaxAttempts.

type Store

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

Store decorates a local ScheduledJobStorage. Reads delegate to it, and writes also deploy the job's Actions workflow to GitHub, directly or through a PR, one sequence at a time. A failed GitHub sync aborts the local write, so no phantom jobs.

func NewStore

NewStore wraps inner with GitHub workflow sync. runner is typically &githubsetup.RealRunner{}.

func (*Store) DeleteJob

func (s *Store) DeleteJob(ctx context.Context, id string) error

DeleteJob removes the job's workflow from the repo (skipped when the file is absent), then deletes the job locally.

func (*Store) LastPRURL

func (s *Store) LastPRURL() string

LastPRURL returns the URL of the PR opened by the most recent successful SaveJob/DeleteJob, or "" when the last write needed no PR. The schedule tool type-asserts for this to surface the link to the user.

func (*Store) ListJobs

func (s *Store) ListJobs(ctx context.Context) ([]*scheddomain.ScheduledJob, error)

ListJobs delegates to the local store.

func (*Store) LoadJob

func (s *Store) LoadJob(ctx context.Context, id string) (*scheddomain.ScheduledJob, error)

LoadJob delegates to the local store.

func (*Store) SaveJob

func (s *Store) SaveJob(ctx context.Context, job *scheddomain.ScheduledJob) error

SaveJob renders the job's workflow, deploys it to the repo, then persists the job locally. Validation failures and gh errors abort before the local save.

Jump to

Keyboard shortcuts

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