migrator

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 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, token, org, repo string, dryRun, continueOnError bool) *Migrator

New creates a new migrator with specified options.

If dryRun is true it will only perform GET requests that do not change github.

func (*Migrator) Migrate

func (m *Migrator) Migrate(prOptions *github.PullRequestListOptions) 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 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.

func RetireMode

func RetireMode(origContext, newContext 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.

Jump to

Keyboard shortcuts

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