runner

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package runner provides workflow execution functionality using the GitHub CLI.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRunFound = errors.New("no run found for workflow")

ErrNoRunFound indicates no workflow run was found after dispatch.

Functions

func BuildArgs

func BuildArgs(cfg RunConfig) []string

BuildArgs constructs the gh workflow run arguments.

func DetectRepo

func DetectRepo() (string, error)

DetectRepo returns the current repository in "owner/repo" format.

func DetectRepoWithDetector

func DetectRepoWithDetector(det RepositoryDetector) (string, error)

DetectRepoWithDetector returns the current repository in "owner/repo" format using det.

func DryRun

func DryRun(cfg RunConfig) string

DryRun prints the command that would be executed without running it.

func Execute

func Execute(cfg RunConfig) error

Execute runs the workflow using gh CLI. It prints the command being run (like lazygit) then executes it.

func ExecuteAndGetRunID

func ExecuteAndGetRunID(cfg RunConfig, client GitHubClient) (int64, error)

ExecuteAndGetRunID runs the workflow and returns the run ID for watching. This polls the API shortly after dispatch to find the triggered run.

func ExecuteAndGetRunIDWithExecutor

func ExecuteAndGetRunIDWithExecutor(cfg RunConfig, client GitHubClient, cmdExec CommandExecutor) (int64, error)

ExecuteAndGetRunIDWithExecutor runs the workflow using the given executor and returns the triggered run ID.

func ExecuteWithExecutor

func ExecuteWithExecutor(cfg RunConfig, cmdExec CommandExecutor) error

ExecuteWithExecutor runs the workflow using the given executor instead of the package default.

func FormatCommand

func FormatCommand(args []string) string

FormatCommand returns a human-readable command string.

func SetExecutor

func SetExecutor(cmdExec execpkg.CommandExecutor)

SetExecutor sets the command executor for testing purposes. Pass nil to reset to default behavior.

Types

type CommandExecutor

type CommandExecutor interface {
	Execute(name string, args ...string) error
}

CommandExecutor executes shell commands (for testing compatibility).

type GitHubClient

type GitHubClient interface {
	GetLatestRun(workflowName string) (*github.WorkflowRun, error)
}

GitHubClient defines the interface for GitHub API operations needed by the runner.

type Repository

type Repository struct {
	Owner string
	Name  string
}

Repository represents a GitHub repository.

type RepositoryDetector

type RepositoryDetector interface {
	Current() (Repository, error)
}

RepositoryDetector detects the current GitHub repository.

type RunConfig

type RunConfig struct {
	Inputs   map[string]string
	Workflow string
	Branch   string
	Watch    bool
}

RunConfig holds the configuration for running a workflow.

Jump to

Keyboard shortcuts

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