Documentation
¶
Index ¶
- Constants
- func WithConfig(ctx context.Context, config *Config) context.Context
- type Action
- type ActionStep
- type Actions
- type AddLabelAction
- type ApproveAction
- type BaseAction
- type CloseAction
- type CommentAction
- type Config
- type IgnoreActivityFrom
- type Include
- type Label
- type Labels
- type LockDiscussionAction
- type RemoveLabelAction
- type ReopenAction
- type UnapproveAction
- type UnlockDiscussionAction
- type UpdateDescriptionAction
Constants ¶
View Source
const ( ConditionalLabel labelType = "conditional" GenerateLabels labelType = "generate" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶ added in v0.3.0
type Action struct {
// The name of the action, this is purely for debugging and your convenience.
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.name
Name string `json:"name" yaml:"name"`
// (Optional) Only one action per group (in order) will be executed per evaluation cycle.
// Use this to 'stop' other actions from running with the same group name
Group string `json:"group,omitempty" yaml:"group,omitempty"`
// A key controlling if the action should executed or not.
//
// This script is in Expr-lang: https://expr-lang.org/docs/language-definition
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if
If string `json:"if" yaml:"if"`
// The list of operations to take if the action.if returned true.
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then
Then []ActionStep `json:"then" yaml:"then"`
}
type ActionStep ¶ added in v0.3.0
This key controls what kind of action that should be taken.
See: https://jippi.github.io/scm-engine/configuration/#actions.if.then
func (ActionStep) JSONSchema ¶ added in v0.18.0
func (step ActionStep) JSONSchema() *jsonschema.Schema
func (ActionStep) OptionalString ¶ added in v0.18.0
func (step ActionStep) OptionalString(name, defaultValue string) (string, error)
func (ActionStep) RequiredString ¶ added in v0.18.0
func (step ActionStep) RequiredString(name string) (string, error)
type AddLabelAction ¶ added in v0.18.0
type AddLabelAction struct {
BaseAction
// The label name to add.
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then.action
Label string `json:"label" yaml:"label"`
}
type BaseAction ¶ added in v0.18.0
type BaseAction struct {
// The action to take
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then.action
Action string `json:"action" yaml:"action"`
}
type CloseAction ¶ added in v0.18.0
type CloseAction struct {
BaseAction
}
type CommentAction ¶ added in v0.18.0
type CommentAction struct {
BaseAction
// The message that will be commented on the Merge Request
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then.action
Message string `json:"message" yaml:"message"`
}
type Config ¶
type Config struct {
// (Optional) When on, no actions will be taken, but instead logged for review
DryRun *bool `json:"dry_run,omitempty" yaml:"dry_run" jsonschema:"default=false"`
// (Optional) Import configuration from other git repositories
//
// See: https://jippi.github.io/scm-engine/configuration/#include
Includes []Include `json:"include,omitempty" yaml:"include"`
// (Optional) Configure what users that should be ignored when considering activity on a Merge Request
//
// SCM-Engine defines activity as comments, reviews, commits, adding/removing labels and similar actions made on a change request.
//
// See: https://jippi.github.io/scm-engine/configuration/#ignore_activity_from
IgnoreActivityFrom IgnoreActivityFrom `json:"ignore_activity_from,omitempty" yaml:"ignore_activity_from"`
// (Optional) Actions can modify a Merge Request in various ways, for example, adding a comment or closing the Merge Request.
//
// See: https://jippi.github.io/scm-engine/configuration/#actions
Actions Actions `json:"actions,omitempty" yaml:"actions"`
// (Optional) Labels are a way to categorize and filter issues, merge requests, and epics in GitLab. -- GitLab documentation
//
// See: https://jippi.github.io/scm-engine/configuration/#label
Labels Labels `json:"label,omitempty" yaml:"label"`
}
func FromContext ¶ added in v0.10.1
func ParseFileString ¶ added in v0.16.0
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 IgnoreActivityFrom ¶ added in v0.10.1
type IgnoreActivityFrom struct {
// (Optional) Should bot users be ignored when considering activity? Default: false
//
// See: https://jippi.github.io/scm-engine/configuration/#ignore_activity_from.bots
IsBot bool `json:"bots,omitempty" yaml:"bots" jsonschema:"default=false"`
// (Optional) A list of usernames that should be ignored when considering user activity. Default: []
//
// See: https://jippi.github.io/scm-engine/configuration/#ignore_activity_from.usernames
Usernames []string `json:"usernames,omitempty" yaml:"usernames"`
// (Optional) A list of emails that should be ignored when considering user activity. Default: []
// NOTE: If a user do not have a public email configured on their profile, that users activity will never match this rule.
//
// See: https://jippi.github.io/scm-engine/configuration/#ignore_activity_from.emails
Emails []string `json:"emails,omitempty" yaml:"emails"`
}
type Include ¶ added in v0.16.0
type Include struct {
// The project to include files from
//
// See: https://jippi.github.io/scm-engine/configuration/#include.project
Project string `json:"project" yaml:"project"`
// The list of files to include from the project. The paths must be relative to the repository root, e.x. label/some-config-file.yml; NOT /label/some-config-file.yml
//
// See: https://jippi.github.io/scm-engine/configuration/#include.files
Files []string `json:"files" yaml:"files"`
// (Optional) Git reference to read the configuration from; it can be a tag, branch, or commit SHA.
//
// If omitted, HEAD is used; meaning your default branch.
//
// See: https://jippi.github.io/scm-engine/configuration/#include.ref
Ref *string `json:"ref,omitempty" yaml:"ref"`
}
type Label ¶
type Label struct {
// (Optional) 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
//
// See: https://jippi.github.io/scm-engine/configuration/#label.strategy
Strategy labelType `json:"strategy,omitempty" yaml:"strategy,omitempty" jsonschema:"default=conditional,enum=conditional,enum=generate"`
// Name of the label being generated.
//
// May only be used with [conditional] labelling type
//
// See: https://jippi.github.io/scm-engine/configuration/#label.name
Name string `json:"name,omitempty" yaml:"name,omitempty" jsonschema:"dependentRequired"`
// (Optional) Description for the label being generated.
//
// See: https://jippi.github.io/scm-engine/configuration/#label.description
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// (Optional) 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
//
// See: https://jippi.github.io/scm-engine/configuration/#label.color
Color string `json:"color,omitempty" yaml:"color,omitempty"`
// (Optional) 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.
//
// See: https://jippi.github.io/scm-engine/configuration/#label.priority
Priority types.Value[int] `json:"priority,omitempty" yaml:"priority,omitempty"`
// Script contains the (https://expr-lang.org/) script used to emit labels for the MR.
//
// See: https://jippi.github.io/scm-engine/configuration/#label.script
Script string `json:"script" yaml:"script,omitempty"`
// SkipIf is an optional (https://expr-lang.org/) script, returning a boolean, wether to
// skip (true) or process (false) this label step.
//
// See: https://jippi.github.io/scm-engine/configuration/#label.skip_if
SkipIf string `json:"skip_if,omitempty" yaml:"skip_if,omitempty"`
// contains filtered or unexported fields
}
func (*Label) Evaluate ¶
func (p *Label) Evaluate(ctx context.Context, evalContext scm.EvalContext) ([]scm.EvaluationResult, error)
func (*Label) ShouldSkip ¶
type Labels ¶
type Labels []*Label
func (Labels) Evaluate ¶
func (labels Labels) Evaluate(ctx context.Context, evalContext scm.EvalContext) ([]scm.EvaluationResult, error)
type LockDiscussionAction ¶ added in v0.18.0
type LockDiscussionAction struct {
BaseAction
}
type RemoveLabelAction ¶ added in v0.18.0
type RemoveLabelAction struct {
BaseAction
// The label name to remove.
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then.action
Label string `json:"label" yaml:"label"`
}
type ReopenAction ¶ added in v0.18.0
type ReopenAction struct {
BaseAction
}
type UnapproveAction ¶ added in v0.18.0
type UnapproveAction struct {
BaseAction
}
type UnlockDiscussionAction ¶ added in v0.18.0
type UnlockDiscussionAction struct {
BaseAction
}
type UpdateDescriptionAction ¶ added in v0.18.0
type UpdateDescriptionAction struct {
BaseAction
// A list of key/value pairs to replace in the description.
// The key is the raw string to replace in the Merge Request description.
// The value is an Expr Lang expression returning a string that key will be replaced with
//
// See: https://jippi.github.io/scm-engine/configuration/#actions.if.then.action
Replace map[string]string `json:"replace" yaml:"replace"`
}
Updates the Merge Request Description
Click to show internal directories.
Click to hide internal directories.