publication

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package publication implements durable publication policy config helpers.

Index

Constants

View Source
const UserConfigFile = "config.yaml"

Variables

This section is empty.

Functions

func CurrentBranch

func CurrentBranch(projectRoot string) (string, error)

func NormalizeActions

func NormalizeActions(input []string) ([]string, error)

func UserConfigPath

func UserConfigPath() (string, error)

func ValidateActions

func ValidateActions(actions []string) error

Types

type BlockedAction

type BlockedAction struct {
	Action string `json:"action" yaml:"action"`
	Reason string `json:"reason" yaml:"reason"`
}

type BranchCheckResult

type BranchCheckResult struct {
	Branch  string         `json:"branch" yaml:"branch"`
	Allowed bool           `json:"branch_push_allowed" yaml:"branch_push_allowed"`
	Reason  string         `json:"branch_block_reason" yaml:"branch_block_reason"`
	Sources []PolicySource `json:"policy_sources" yaml:"policy_sources"`
}

func CheckBranch

func CheckBranch(branch string, policy BranchPolicy) BranchCheckResult

type BranchPolicy

type BranchPolicy struct {
	AllowBranches []string
	DenyBranches  []string
	Sources       []PolicySource
}

type Policy

type Policy struct {
	Actions []string `json:"actions" yaml:"actions"`
}

type PolicySource

type PolicySource struct {
	Scope   string   `json:"scope" yaml:"scope"`
	Path    string   `json:"path" yaml:"path"`
	Key     string   `json:"key" yaml:"key"`
	Actions []string `json:"actions,omitempty" yaml:"actions,omitempty"`
}

type ResolveOptions

type ResolveOptions struct {
	ProjectRoot    string
	UserConfigPath string
	Command        string
	Event          string
	Milestone      string
	TaskPolicy     []string
	SessionPolicy  []string
	Branch         string
}

type ResolveResult

type ResolveResult struct {
	ActionsResolved   []string        `json:"actions_resolved" yaml:"actions_resolved"`
	ActionsAllowed    []string        `json:"actions_allowed" yaml:"actions_allowed"`
	ActionsBlocked    []BlockedAction `json:"actions_blocked" yaml:"actions_blocked"`
	PolicySources     []PolicySource  `json:"policy_sources" yaml:"policy_sources"`
	Branch            string          `json:"branch" yaml:"branch"`
	BranchPushAllowed bool            `json:"branch_push_allowed" yaml:"branch_push_allowed"`
	BranchBlockReason string          `json:"branch_block_reason" yaml:"branch_block_reason"`
}

func Resolve

func Resolve(opts ResolveOptions) (ResolveResult, error)

type SetOptions

type SetOptions struct {
	Scope       string
	ProjectRoot string
	Command     string
	Event       string
	Milestone   string
	Default     bool
	Actions     []string
}

type SetResult

type SetResult struct {
	Scope        string   `json:"scope" yaml:"scope"`
	Path         string   `json:"path" yaml:"path"`
	Key          string   `json:"key" yaml:"key"`
	Actions      []string `json:"actions" yaml:"actions"`
	TouchedPaths []string `json:"touched_paths" yaml:"touched_paths"`
}

func SetPolicy

func SetPolicy(opts SetOptions) (SetResult, error)

Jump to

Keyboard shortcuts

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