migrator

package
v0.0.0-...-37c3036 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migrator

type Migrator struct {
	Mode
	// contains filtered or unexported fields
}

Migrator will search github for PRs with a given context and migrate/retire/move them.

func New

func New(mode Mode, client github.Client, org, repo string, targetBranchFilter func(string) bool, continueOnError bool) *Migrator

New creates a new migrator with specified options and client.

func (*Migrator) Migrate

func (m *Migrator) Migrate() error

Migrate will retire/migrate/copy statuses for all matching PRs.

type Mode

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

Mode is a struct that describes the behavior of a status migration. The behavior is described as a list of conditions and a function that determines the actions to be taken when the conditions are met.

func CopyMode

func CopyMode(origContext, newContext string) *Mode

CopyMode makes a mode that creates a new context in every PR that has the old context, but not the new one. The state, description and target URL of the new context are made the same as those of the old context.

func MoveMode

func MoveMode(origContext, newContext, targetURL string) *Mode

MoveMode creates a mode that both copies and retires. The mode creates a new context on every PR with the old context but not the new one, setting the state of the new context to that of the old context before retiring the old context. A target URL to describe why the old context was migrated can optionally be provided, as well.

func RetireMode

func RetireMode(origContext, newContext, targetURL string) *Mode

RetireMode creates a mode that retires an old context on all PRs. If newContext is the empty string, origContext is retired without replacement. Its state is set to 'success' and its description is set to indicate that the context is retired. If newContext is not the empty string it is considered the replacement of origContext. This means that only PRs that have the newContext in addition to the origContext will be considered and the description of the retired context will indicate that it was replaced by newContext. A target URL to describe why the old context was migrated can optionally be provided, as well.

Jump to

Keyboard shortcuts

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