Documentation
¶
Index ¶
- func ValidateInputs(data map[string]string, t *Task) []error
- type Registry
- type RepositoryFilter
- type Task
- func (tw *Task) CalcAutoMergeAfter() time.Duration
- func (tw *Task) Checksum() string
- func (tw *Task) HasReachMaxOpenPRs() bool
- func (tw *Task) HasReachedChangeLimit() bool
- func (tw *Task) IncChangeLimitCount()
- func (tw *Task) IncOpenPRsCount()
- func (tw *Task) OnPrClosed(ctx context.Context) error
- func (tw *Task) OnPrCreated(_ context.Context) error
- func (tw *Task) OnPrMerged(_ context.Context) error
- func (tw *Task) Path() string
- func (tw *Task) RenderBranchName(data template.Data) (string, error)
- func (tw *Task) RenderPrTitle(data template.Data) (string, error)
- func (tw *Task) RepositoryFilters() []*RepositoryFilter
- func (tw *Task) RunData() map[string]string
- func (tw *Task) ScriptShellWithFallback() string
- func (tw *Task) ScriptTimeoutDuration() time.Duration
- func (tw *Task) SetInputs(runData map[string]string) error
- func (tw *Task) Stop()
- func (tw *Task) UpdateLabels(label ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry contains all tasks.
func NewRegistry ¶
func (*Registry) GetTask ¶ added in v0.43.2
GetTask returns the task identified by name. It returns an error if the task could not be found.
func (*Registry) GetTasks ¶
GetTasks returns all tasks registered with the Registry. Should be called only after ReadAll() has been called at least once.
func (*Registry) ReadAll ¶
ReadAll takes a list of paths to task files and reads all tasks from the files.
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 (*Task) HasReachMaxOpenPRs ¶
func (*Task) HasReachedChangeLimit ¶
func (*Task) IncChangeLimitCount ¶
func (tw *Task) IncChangeLimitCount()
func (*Task) IncOpenPRsCount ¶
func (tw *Task) IncOpenPRsCount()
func (*Task) OnPrClosed ¶
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 ¶
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 ¶
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 ¶
Path returns the path to the file of the task. It always returns the absolute path to the file.
func (*Task) RenderBranchName ¶
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 ¶
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
ScriptShellWithFallback returns the shell to use to execute schema.Task.
func (*Task) ScriptTimeoutDuration ¶ added in v0.40.0
ScriptTimeoutDuration returns the timeout to use to execute schema.Task as a time.Duration.
func (*Task) SetInputs ¶
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 ¶
UpdateLabels updates the labels of the task with one or more label. It removes any duplicate labels.