action

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: GPL-3.0 Imports: 17 Imported by: ? 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	Execute(ctx context.Context, execCtx *ExecutionContext) error
}

Action is the interface that all operation types implement.

func FromOperation

func FromOperation(op config.Operation) (Action, error)

FromOperation returns the appropriate Action for an Operation.

type ActionFactory

type ActionFactory func() Action

ActionFactory creates an Action from raw operation config.

type CommitPushAction

type CommitPushAction struct {
	Config config.CommitPush
}

CommitPushAction commits all changes and pushes to the remote.

func (*CommitPushAction) Execute

func (a *CommitPushAction) Execute(ctx context.Context, execCtx *ExecutionContext) error

type ExecutionContext

type ExecutionContext struct {
	// ModuleDir is the path to the module directory containing loom.yaml.
	ModuleDir string
	// TargetDir is the path to the target repository working directory.
	TargetDir string
	// Params are the resolved template parameters.
	Params map[string]string
	// Excludes are glob patterns for files/dirs to exclude from template walking.
	Excludes []string
	// Includes are glob patterns that override excludes (including implicit ones).
	Includes []string
	// DryRun indicates whether to simulate operations.
	DryRun bool
	// LocalOnly runs all operations locally but skips remote push and PR creation.
	LocalOnly bool
	// ShowDiff displays file diffs during dry-run.
	ShowDiff bool
	// Logger is the structured logger.
	Logger *slog.Logger
}

ExecutionContext holds runtime state shared across actions.

type NewFilesAction

type NewFilesAction struct {
	Config config.NewFiles
}

NewFilesAction renders template files from the module directory and writes them to the target directory.

func (*NewFilesAction) Execute

func (a *NewFilesAction) Execute(ctx context.Context, execCtx *ExecutionContext) error

type PRAction

type PRAction struct {
	Config config.PR
}

PRAction opens a pull request or merge request.

func (*PRAction) Execute

func (a *PRAction) Execute(ctx context.Context, execCtx *ExecutionContext) error

type PatchAction

type PatchAction struct {
	Config config.Patch
}

PatchAction applies patch operations to a target YAML file using the kustomize library. Two engines are supported:

  • "smp" (default): Strategic Merge Patch — a partial YAML document deep-merged into the target.
  • "json6902": RFC 6902 JSON Patch — an explicit list of add/remove/replace/move/copy/test operations.

func (*PatchAction) Execute

func (a *PatchAction) Execute(ctx context.Context, execCtx *ExecutionContext) error

type ShellAction

type ShellAction struct {
	Config config.Shell
}

ShellAction runs a shell command on the host.

func (*ShellAction) Execute

func (a *ShellAction) Execute(ctx context.Context, execCtx *ExecutionContext) error

Jump to

Keyboard shortcuts

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