hooks

package
v0.0.0-...-8f9dc6d Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) *int

func Strings

func Strings(errors []error) []string

func WithSecondary

func WithSecondary(primary error, secondary []error) error

Types

type CommandError

type CommandError struct {
	Event    config.HookEvent
	Index    int
	Command  string
	ExitCode int
	Err      error
}

func (*CommandError) Error

func (hookError *CommandError) Error() string

func (*CommandError) Unwrap

func (hookError *CommandError) Unwrap() error

type CommandOutput

type CommandOutput struct {
	Stdout   string
	Stderr   string
	ExitCode int
}

type CommandRunner

type CommandRunner interface {
	Run(context.Context, string, string, []string) (CommandOutput, error)
}

type Context

type Context struct {
	Stage          string   `json:"stage,omitempty"`
	Source         string   `json:"source,omitempty"`
	Output         []string `json:"output,omitempty"`
	CurrentVersion string   `json:"current_version,omitempty"`
	NextVersion    string   `json:"next_version,omitempty"`
	ProjectName    string   `json:"project_name,omitempty"`
	GitTag         string   `json:"git_tag,omitempty"`
	FilePaths      []string `json:"file_paths,omitempty"`
	CommitMessage  string   `json:"commit_message,omitempty"`
	CommitPaths    []string `json:"commit_paths,omitempty"`
	Tag            string   `json:"tag,omitempty"`
	PushCommit     bool     `json:"push_commit"`
	PushTag        bool     `json:"push_tag"`
	Applied        bool     `json:"applied"`
	DryRun         bool     `json:"dry_run"`
	Completed      []string `json:"completed,omitempty"`
	ErrorStage     string   `json:"error_stage,omitempty"`
	ErrorMessage   string   `json:"error_message,omitempty"`
	ErrorExitCode  *int     `json:"error_exit_code,omitempty"`
	Secondary      []string `json:"secondary_errors,omitempty"`
}

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, cwd, command string, environment []string) (CommandOutput, error)

type LifecycleError

type LifecycleError struct {
	Primary   error
	Secondary []error
}

func (*LifecycleError) Error

func (lifecycleError *LifecycleError) Error() string

func (*LifecycleError) Unwrap

func (lifecycleError *LifecycleError) Unwrap() error

type Options

type Options struct {
	Config      config.HooksConfig
	CWD         string
	ConfigPath  string
	Target      string
	Runner      CommandRunner
	Environment []string
	TempDir     string
	Reporter    io.Writer
	JSON        bool
}

type Result

type Result struct {
	Event      config.HookEvent `json:"event"`
	Kind       string           `json:"kind"`
	Index      int              `json:"index"`
	Status     string           `json:"status"`
	DurationMS int64            `json:"duration_ms"`
	ExitCode   *int             `json:"exit_code,omitempty"`
	Stdout     string           `json:"stdout,omitempty"`
	Stderr     string           `json:"stderr,omitempty"`
}

type Session

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

func NewSession

func NewSession(options Options) (*Session, error)

func (*Session) Cleanup

func (session *Session) Cleanup() error

func (*Session) ContextPath

func (session *Session) ContextPath() string

func (*Session) Results

func (session *Session) Results() []Result

func (*Session) Run

func (session *Session) Run(ctx context.Context, event config.HookEvent, hookContext Context) error

func (*Session) RunBestEffort

func (session *Session) RunBestEffort(ctx context.Context, event config.HookEvent, hookContext Context) []error

func (*Session) SecondaryErrors

func (session *Session) SecondaryErrors() []error

Jump to

Keyboard shortcuts

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