hooks

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookConfig

type HookConfig struct {
	Name       string            `yaml:"name"`
	Type       string            `yaml:"type"`        // "builtin" or "command"
	Command    string            `yaml:"command"`     // for type=command
	WorkingDir string            `yaml:"working_dir"` // optional working directory
	Args       []string          `yaml:"args"`        // arguments for the command
	Config     map[string]string `yaml:"config"`      // configuration for builtin hooks
	Required   bool              `yaml:"required"`    // whether failure should block operation
}

HookConfig represents a single hook configuration

type HookContext

type HookContext struct {
	Branch      string
	Environment string
	UserEmail   string
	UserName    string
	BaseBranch  string
}

HookContext provides context to hook execution

type HookExecutor

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

HookExecutor handles hook execution

func NewHookExecutor

func NewHookExecutor(config *HooksConfig) *HookExecutor

NewHookExecutor creates a new hook executor

func (*HookExecutor) ExecuteHooks

func (he *HookExecutor) ExecuteHooks(ctx context.Context, hookType HookType, hookCtx HookContext) []HookResult

ExecuteHooks executes hooks of a specific type

type HookResult

type HookResult struct {
	Hook    HookConfig
	Success bool
	Output  string
	Error   error
}

HookResult represents the result of hook execution

type HookType

type HookType string

HookType represents different types of hooks

const (
	PrePromote  HookType = "pre-promote"
	PostPromote HookType = "post-promote"
	PreRelease  HookType = "pre-release"
	PostRelease HookType = "post-release"
)

type HooksConfig

type HooksConfig struct {
	PrePromote  []HookConfig `yaml:"pre-promote"`
	PostPromote []HookConfig `yaml:"post-promote"`
	PreRelease  []HookConfig `yaml:"pre-release"`
	PostRelease []HookConfig `yaml:"post-release"`
}

HookConfig represents the complete hook configuration

func LoadConfig

func LoadConfig(meta *metadata.Metadata) (*HooksConfig, error)

LoadConfig loads hook configuration from metadata

Jump to

Keyboard shortcuts

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