config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionalLabel labelType = "conditional"
	GenerateLabels   labelType = "generate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.3.0

func (*Action) Evaluate added in v0.3.0

func (p *Action) Evaluate(evalContext scm.EvalContext) (bool, error)

type Actions added in v0.3.0

type Actions []Action

func (Actions) Evaluate added in v0.3.0

func (actions Actions) Evaluate(evalContext scm.EvalContext) ([]Action, error)

type Config

type Config struct {
	Labels  Labels  `yaml:"label"`
	Actions Actions `yaml:"actions"`
}

func LoadFile

func LoadFile(path string) (*Config, error)

LoadFile loads and parses a GITLAB_LABELS file at the path specified.

func ParseFile

func ParseFile(f io.Reader) (*Config, error)

ParseFile parses a Gitlabber file, returning a Config.

func (Config) Evaluate

func (c Config) Evaluate(ctx context.Context, evalContext scm.EvalContext) ([]scm.EvaluationResult, []Action, error)

type Label

type Label struct {
	// Strategy used for the label
	//
	// - "conditional" will, based on the boolean output of [script], control if the label [name] should be added/removed on the MR
	// - "computed" will, based on the list of strings output of [script], add/remove labels on the MR
	Strategy labelType `yaml:"strategy"`

	// Name of the label being generated.
	//
	// May only be used with [conditional] labelling type
	Name string `yaml:"name"`

	// Description for the label being generated.
	//
	// Optional; will be an empty string if omitted
	Description string `yaml:"description"`

	// The HEX color code to use for the label.
	//
	// May use the color variables (e.g., $purple-300) defined in Twitter Bootstrap
	// https://getbootstrap.com/docs/5.3/customize/color/#all-colors
	Color string `yaml:"color"`

	// Priority controls wether the label should be a priority label or regular one.
	//
	// This controls if the label is prioritized (sorted first) in the list.
	Priority types.Value[int] `yaml:"priority"`

	// Script contains the [expr-lang](https://expr-lang.org/) script used to emit labels for the MR.
	//
	// Please see [Type] documentation for more information.
	Script string `yaml:"script"`

	// SkipIf is an optional [expr-lang](https://expr-lang.org/) script, returning a boolean, wether to
	// skip (true) or process (false) this label step.
	SkipIf string `yaml:"skip_if"`
	// contains filtered or unexported fields
}

func (*Label) Evaluate

func (p *Label) Evaluate(evalContext scm.EvalContext) ([]scm.EvaluationResult, error)

func (*Label) ShouldSkip

func (p *Label) ShouldSkip(evalContext scm.EvalContext) (bool, error)

type Labels

type Labels []*Label

func (Labels) Evaluate

func (labels Labels) Evaluate(evalContext scm.EvalContext) ([]scm.EvaluationResult, error)

Jump to

Keyboard shortcuts

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