task

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateInputs

func ValidateInputs(data map[string]string, t *Task) []error

ValidateInputs validates the values in data. It returns a list of errors where each error details a failed validation.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry contains all tasks.

func NewRegistry

func NewRegistry(opts options.Opts) *Registry

func (*Registry) GetTask added in v0.43.2

func (tr *Registry) GetTask(name string) (*Task, error)

GetTask returns the task identified by name. It returns an error if the task could not be found.

func (*Registry) GetTasks

func (tr *Registry) GetTasks() []*Task

GetTasks returns all tasks registered with the Registry. Should be called only after ReadAll() has been called at least once.

func (*Registry) ReadAll

func (tr *Registry) ReadAll(taskFiles []string) error

ReadAll takes a list of paths to task files and reads all tasks from the files.

func (*Registry) ReadTasks

func (tr *Registry) ReadTasks(taskFile string) error

ReadTasks reads all tasks defined in taskFile and adds them to the registry.

func (*Registry) Stop

func (tr *Registry) Stop()

Stop notifies every task that this Registry is being stopped. This usually happens at the end of a run. Every task can then execute code to clean itself up.

type RepositoryFilter added in v0.41.0

type RepositoryFilter struct {
	// contains filtered or unexported fields
}

RepositoryFilter filters a repository based on its host, owner and name properties.

func NewRepositoryFilter added in v0.41.0

func NewRepositoryFilter(data schema.RepositoryFilter) (*RepositoryFilter, error)

NewRepositoryFilter returns a new RepositoryFilter.

func (*RepositoryFilter) Filter added in v0.41.0

func (rf *RepositoryFilter) Filter(repo host.Repository) bool

Filter checks if it matches the given repository.

func (*RepositoryFilter) String added in v0.41.0

func (rf *RepositoryFilter) String() string

String implements fmt.Stringer.

type Task

type Task struct {
	schema.Task

	// The time range in which auto-merging pull requests is allowed.
	// A value of nil indicates that no time range is set.
	AutoMergeTimeRange *timerange.TimeRange
	// The [time.Location] to use when checking if a time is within the auto-merge time range.
	AutoMergeTimeLocation *time.Location
	// CommitMessageTemplate is the value of CommitMessage parsed to a template.
	CommitMessageTemplate *htmlTemplate.Template
	// contains filtered or unexported fields
}

func (*Task) CalcAutoMergeAfter

func (tw *Task) CalcAutoMergeAfter() time.Duration

func (*Task) Checksum

func (tw *Task) Checksum() string

func (*Task) HasReachMaxOpenPRs

func (tw *Task) HasReachMaxOpenPRs() bool

func (*Task) HasReachedChangeLimit

func (tw *Task) HasReachedChangeLimit() bool

func (*Task) IncChangeLimitCount

func (tw *Task) IncChangeLimitCount()

func (*Task) IncOpenPRsCount

func (tw *Task) IncOpenPRsCount()

func (*Task) OnPrClosed

func (tw *Task) OnPrClosed(ctx context.Context) error

OnPrClosed executes hooks when a merge request has been closed. It currently does nothing and will be implemented in a future refactoring.

func (*Task) OnPrCreated

func (tw *Task) OnPrCreated(_ context.Context) error

OnPrCreated executes hooks when a merge request has been created. It currently does nothing and will be implemented in a future refactoring.

func (*Task) OnPrMerged

func (tw *Task) OnPrMerged(_ context.Context) error

OnPrMerged executes hooks when a merge request has been merged. It currently does nothing and will be implemented in a future refactoring.

func (*Task) Path

func (tw *Task) Path() string

Path returns the path to the file of the task. It always returns the absolute path to the file.

func (*Task) RenderBranchName

func (tw *Task) RenderBranchName(data template.Data) (string, error)

func (*Task) RenderPrTitle

func (tw *Task) RenderPrTitle(data template.Data) (string, error)

func (*Task) RepositoryFilters added in v0.41.0

func (tw *Task) RepositoryFilters() []*RepositoryFilter

RepositoryFilters returns the list of RepositoryFilter instances of the task.

func (*Task) RunData

func (tw *Task) RunData() map[string]string

RunData returns a map that stores runtime data. This includes inputs set via the command-line interface.

func (*Task) ScriptShellWithFallback added in v0.40.0

func (tw *Task) ScriptShellWithFallback() string

ScriptShellWithFallback returns the shell to use to execute schema.Task.

func (*Task) ScriptTimeoutDuration added in v0.40.0

func (tw *Task) ScriptTimeoutDuration() time.Duration

ScriptTimeoutDuration returns the timeout to use to execute schema.Task as a time.Duration.

func (*Task) SetInputs

func (tw *Task) SetInputs(runData map[string]string) error

SetInputs takes incoming runData and verifies it against the inputs defined by a task. Creates a copy of runData and stores it as part of the Task. Applies default values of inputs if the key of an input isn't set in runData. It returns an error if an expected input isn't supplied and no default value for the input has been set.

func (*Task) Stop

func (tw *Task) Stop()

Stop executes hooks when a task is stopped. It currently does nothing and will be implemented in a future refactoring.

func (*Task) UpdateLabels

func (tw *Task) UpdateLabels(label ...string)

UpdateLabels updates the labels of the task with one or more label. It removes any duplicate labels.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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