environment

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BehaviorProduction = "production" // Full execution (dangerous in local)
	BehaviorDraft      = "draft"      // Create drafts only (GitHub releases)
	BehaviorNoPush     = "no-push"    // Build without push (Docker)
	BehaviorDryRun     = "dry-run"    // Dry run only
	BehaviorDisabled   = "disabled"   // Completely disabled in local
)

LocalBehavior defines how a preset behaves in local environment

Variables

This section is empty.

Functions

func ApplyExecutionMode

func ApplyExecutionMode(preset presets.Preset, mode *ExecutionMode) presets.Preset

ApplyExecutionMode applies the execution mode to a preset

Types

type Environment

type Environment struct {
	IsCI       bool
	Provider   string // github, gitlab, jenkins, etc.
	IsPR       bool   // Is this a pull/merge request?
	IsTag      bool   // Is this a tag build?
	BranchName string
	TagName    string
}

Environment represents the execution environment

func Detect

func Detect() *Environment

Detect automatically detects the current environment

func (*Environment) IsLocal

func (e *Environment) IsLocal() bool

IsLocal returns true if running in local environment

func (*Environment) String

func (e *Environment) String() string

String returns a human-readable representation

type ExecutionMode

type ExecutionMode struct {
	Allowed    bool              // Can this preset run in current environment?
	Mode       string            // Execution mode (production, draft, no-push, dry-run)
	Reason     string            // Why this mode was chosen
	IsDryRun   bool              // Force dry-run mode
	EnvChanges map[string]string // Environment variable overrides
}

ExecutionMode determines how a preset should be executed

func ValidatePreset

func ValidatePreset(preset presets.Preset, env *Environment) (*ExecutionMode, error)

ValidatePreset checks if a preset can run in the current environment and returns the appropriate execution mode

Jump to

Keyboard shortcuts

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