schema

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(t *Task) error

Types

type Action added in v0.7.0

type Action struct {
	// Identifier of the action.
	Action string `json:"action" yaml:"action" mapstructure:"action"`

	// Key/value pairs passed as parameters to the action.
	Params ActionParams `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`
}

An action tells saturn-bot how to modify a repository.

func (*Action) UnmarshalJSON added in v0.7.0

func (j *Action) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Action) UnmarshalYAML added in v0.7.0

func (j *Action) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type ActionParams added in v0.7.0

type ActionParams map[string]interface{}

Key/value pairs passed as parameters to the action.

type Filter added in v0.7.0

type Filter struct {
	// Identifier of the filter.
	Filter string `json:"filter" yaml:"filter" mapstructure:"filter"`

	// Key/value pairs passed as parameters to the filter.
	Params FilterParams `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// Reverse the result of the filter, i.e. negate it.
	Reverse bool `json:"reverse,omitempty" yaml:"reverse,omitempty" mapstructure:"reverse,omitempty"`
}

func (*Filter) UnmarshalJSON added in v0.7.0

func (j *Filter) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Filter) UnmarshalYAML added in v0.7.0

func (j *Filter) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type FilterParams added in v0.7.0

type FilterParams map[string]interface{}

Key/value pairs passed as parameters to the filter.

type Plugin added in v0.7.0

type Plugin struct {
	// Key/value pairs that hold additional configuration for the plugin. Sent to the
	// plugin once on startup.
	Configuration PluginConfiguration `json:"configuration,omitempty" yaml:"configuration,omitempty" mapstructure:"configuration,omitempty"`

	// Path corresponds to the JSON schema field "path".
	Path string `json:"path" yaml:"path" mapstructure:"path"`
}

A plugin extends saturn-bot and allows custom filtering or modification of repositories.

func (*Plugin) PathAbs added in v0.8.1

func (p *Plugin) PathAbs(taskPath string) string

func (*Plugin) UnmarshalJSON added in v0.7.0

func (j *Plugin) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Plugin) UnmarshalYAML added in v0.7.0

func (j *Plugin) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type PluginConfiguration added in v0.7.0

type PluginConfiguration map[string]string

Key/value pairs that hold additional configuration for the plugin. Sent to the plugin once on startup.

type Task

type Task struct {
	// List of actions that modify a repository.
	Actions []Action `json:"actions,omitempty" yaml:"actions,omitempty" mapstructure:"actions,omitempty"`

	// Set to `false` to temporarily deactivate the task and prevent it from
	// executing.
	Active bool `json:"active,omitempty" yaml:"active,omitempty" mapstructure:"active,omitempty"`

	// A list of usernames to set as assignees of a pull request.
	Assignees []string `json:"assignees,omitempty" yaml:"assignees,omitempty" mapstructure:"assignees,omitempty"`

	// Merge a pull request automatically if all checks have passed and all approvals
	// have been given.
	AutoMerge bool `json:"autoMerge,omitempty" yaml:"autoMerge,omitempty" mapstructure:"autoMerge,omitempty"`

	// If set, automatically merge the pull request after it has been open for the
	// specified amount of time. Only applied if `autoMerge` is `true`. The value is a
	// Go duration, like 5m or 1h.
	AutoMergeAfter string `json:"autoMergeAfter,omitempty" yaml:"autoMergeAfter,omitempty" mapstructure:"autoMergeAfter,omitempty"`

	// If set, used as th name of the branch to commit changes to. Defaults to an
	// auto-generated name if not set.
	BranchName string `json:"branchName,omitempty" yaml:"branchName,omitempty" mapstructure:"branchName,omitempty"`

	// Number of pull requests to create or merge (combined) in one run. Useful to
	// reduce strain on a system caused by, for example, many CI/CD jobs created at
	// the same time.
	ChangeLimit int `json:"changeLimit,omitempty" yaml:"changeLimit,omitempty" mapstructure:"changeLimit,omitempty"`

	// If set, used as the message when changes get committed. Defaults to an
	// auto-generated message if not set.
	CommitMessage string `json:"commitMessage,omitempty" yaml:"commitMessage,omitempty" mapstructure:"commitMessage,omitempty"`

	// Create pull requests only. Don't attempt to update a pull request on a
	// subsequent run.
	CreateOnly bool `json:"createOnly,omitempty" yaml:"createOnly,omitempty" mapstructure:"createOnly,omitempty"`

	// Filters allow targeting a specific repositories.
	Filters []Filter `json:"filters,omitempty" yaml:"filters,omitempty" mapstructure:"filters,omitempty"`

	// If `true`, keep the branch after a pull request has been merged.
	KeepBranchAfterMerge bool `json:"keepBranchAfterMerge,omitempty" yaml:"keepBranchAfterMerge,omitempty" mapstructure:"keepBranchAfterMerge,omitempty"`

	// List of labels to attach to a pull request.
	Labels []string `json:"labels,omitempty" yaml:"labels,omitempty" mapstructure:"labels,omitempty"`

	// The number of pull requests that can be open at the same time. 0 disables the
	// feature.
	MaxOpenPRs int `json:"maxOpenPRs,omitempty" yaml:"maxOpenPRs,omitempty" mapstructure:"maxOpenPRs,omitempty"`

	// If `true`, no new pull request is being created if a previous pull request has
	// been merged for this task.
	MergeOnce bool `json:"mergeOnce,omitempty" yaml:"mergeOnce,omitempty" mapstructure:"mergeOnce,omitempty"`

	// The name of the task. Used as an identifier.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// List of plugins to start for the task.
	Plugins []Plugin `json:"plugins,omitempty" yaml:"plugins,omitempty" mapstructure:"plugins,omitempty"`

	// If set, used as the body of the pull request.
	PrBody string `json:"prBody,omitempty" yaml:"prBody,omitempty" mapstructure:"prBody,omitempty"`

	// If set, used as the title of the pull request.
	PrTitle string `json:"prTitle,omitempty" yaml:"prTitle,omitempty" mapstructure:"prTitle,omitempty"`

	// A list of usernames to set as reviewers of the pull request.
	Reviewers []string `json:"reviewers,omitempty" yaml:"reviewers,omitempty" mapstructure:"reviewers,omitempty"`
}

func Read added in v0.8.0

func Read(path string) ([]Task, []hash.Hash, error)

Read return all Tasks from the file at `path`. It also calculates the hash of the file.

func (*Task) UnmarshalJSON

func (j *Task) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Task) UnmarshalYAML

func (j *Task) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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