Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
UnmarshalJSON implements json.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
UnmarshalJSON implements json.Unmarshaler.
type FilterParams ¶ added in v0.7.0
type FilterParams map[string]interface{}
Key/value pairs passed as parameters to the filter.
type GithubTrigger ¶ added in v0.16.0
type GithubTrigger struct { // Experimental: GitHub webhook event, like push. See // https://docs.github.com/en/webhooks/webhook-events-and-payloads for a list of // all available events. Event *string `json:"event,omitempty" yaml:"event,omitempty" mapstructure:"event,omitempty"` // Experimental: jq expressions to apply to the body of the webhook. If all // expressions match the content of the webhook then a new run of the task is // scheduled. Filters []string `json:"filters,omitempty" yaml:"filters,omitempty" mapstructure:"filters,omitempty"` }
type GitlabTrigger ¶ added in v0.16.0
type GitlabTrigger struct { // Experimental: GitLab webhook event, like push. See // https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html for a // list of all available events. Event *string `json:"event,omitempty" yaml:"event,omitempty" mapstructure:"event,omitempty"` // Experimental: jq expressions to apply to the body of the webhook. If all // expressions match the content of the webhook then a new run of the task is // scheduled. Filters []string `json:"filters,omitempty" yaml:"filters,omitempty" mapstructure:"filters,omitempty"` }
type Input ¶ added in v0.16.0
type Input struct { // Default value to use if no input has been set via the command-line. Default *string `json:"default,omitempty" yaml:"default,omitempty" mapstructure:"default,omitempty"` // Text that describes the input value. Description *string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"` // Key that identifies the input. Set via the command-line to set the input value. Name string `json:"name" yaml:"name" mapstructure:"name"` }
A input allows customizing a task at runtime.
func (*Input) UnmarshalJSON ¶ added in v0.16.0
UnmarshalJSON implements json.Unmarshaler.
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) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON implements json.Unmarshaler.
type PluginConfiguration ¶ added in v0.7.0
Key/value pairs that hold additional configuration for the plugin. Sent to the plugin once on startup.
type ReadResult ¶ added in v0.11.1
func Read ¶ added in v0.8.0
func Read(path string) ([]ReadResult, error)
Read return all Tasks from the file at `path`. It also calculates the hash of the file.
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"` // Automatically close a pull request if it has been unmerged for the duration. // Format is seconds. Set to `0`, the default, to deactivate. AutoCloseAfter int `json:"autoCloseAfter,omitempty" yaml:"autoCloseAfter,omitempty" mapstructure:"autoCloseAfter,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 the 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 make saturn-bot pick the repositories to which it applies the task. Filters []Filter `json:"filters,omitempty" yaml:"filters,omitempty" mapstructure:"filters,omitempty"` // Inputs allows customizing a task at runtime. Inputs []Input `json:"inputs,omitempty" yaml:"inputs,omitempty" mapstructure:"inputs,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"` // Experimental: Define when the task gets executed. Only relevant in server mode. Trigger *TaskTrigger `json:"trigger,omitempty" yaml:"trigger,omitempty" mapstructure:"trigger,omitempty"` }
func (*Task) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type TaskTrigger ¶ added in v0.16.0
type TaskTrigger struct { // Experimental: Trigger the task based on a cron schedule. Cron *string `json:"cron,omitempty" yaml:"cron,omitempty" mapstructure:"cron,omitempty"` // Experimental: Execute the task when the server receives a webhook. Webhook *TaskTriggerWebhook `json:"webhook,omitempty" yaml:"webhook,omitempty" mapstructure:"webhook,omitempty"` }
Experimental: Define when the task gets executed. Only relevant in server mode.
type TaskTriggerWebhook ¶ added in v0.16.0
type TaskTriggerWebhook struct { // Experimental: Delay the execution of the task by this many seconds. Delay int `json:"delay,omitempty" yaml:"delay,omitempty" mapstructure:"delay,omitempty"` // Experimental: Execute the task when the server receives a webhook from GitHub. Github []GithubTrigger `json:"github,omitempty" yaml:"github,omitempty" mapstructure:"github,omitempty"` // Experimental: Execute the task when the server receives a webhook from GitLab. Gitlab []GitlabTrigger `json:"gitlab,omitempty" yaml:"gitlab,omitempty" mapstructure:"gitlab,omitempty"` }
Experimental: Execute the task when the server receives a webhook.
func (*TaskTriggerWebhook) UnmarshalJSON ¶ added in v0.16.0
func (j *TaskTriggerWebhook) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*TaskTriggerWebhook) UnmarshalYAML ¶ added in v0.16.0
func (j *TaskTriggerWebhook) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.