multigitter

package
v0.52.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer added in v0.13.0

type Closer struct {
	VersionController VersionController

	FeatureBranch string
}

Closer closes pull requests

func (Closer) Close added in v0.13.0

func (s Closer) Close(ctx context.Context) error

Close closes pull requests

type ConflictStrategy added in v0.37.0

type ConflictStrategy int

ConflictStrategy define how a conflict of an already existing branch should be handled

const (
	// ConflictStrategySkip will skip the run for if the branch does already exist
	ConflictStrategySkip ConflictStrategy = iota + 1
	// ConflictStrategyReplace will ignore any existing branch and replace it with new changes
	ConflictStrategyReplace
)

func ParseConflictStrategy added in v0.37.0

func ParseConflictStrategy(str string) (ConflictStrategy, error)

ParseConflictStrategy parses a conflict strategy from a string

type Git added in v0.28.0

type Git interface {
	Clone(ctx context.Context, url string, baseName string) error
	ChangeBranch(branchName string) error
	Changes() (bool, error)
	Commit(commitAuthor *git.CommitAuthor, commitMessage string) error
	BranchExist(remoteName, branchName string) (bool, error)
	Push(ctx context.Context, remoteName string, force bool) error
	AddRemote(name, url string) error
}

Git is a git implementation

type Merger

type Merger struct {
	VersionController VersionController

	FeatureBranch string
}

Merger merges pull requests in an organization

func (Merger) Merge

func (s Merger) Merge(ctx context.Context) error

Merge merges pull requests in an organization

type Printer added in v0.12.0

type Printer struct {
	VersionController VersionController

	ScriptPath string // Must be absolute path
	Arguments  []string

	Stdout io.Writer
	Stderr io.Writer

	Concurrent int
	CloneDir   string

	CreateGit func(dir string) Git
}

Printer contains fields to be able to do the print command

func (Printer) Print added in v0.14.0

func (r Printer) Print(ctx context.Context) error

Print runs a script for multiple repositories and print the output of each run

type Runner

type Runner struct {
	VersionController VersionController

	ScriptPath    string // Must be absolute path
	Arguments     []string
	FeatureBranch string

	Output io.Writer

	CommitMessage    string
	PullRequestTitle string
	PullRequestBody  string
	Reviewers        []string
	TeamReviewers    []string
	MaxReviewers     int // If set to zero, all reviewers will be use
	MaxTeamReviewers int // If set to zero, all team-reviewers will be used
	DryRun           bool
	CommitAuthor     *git.CommitAuthor
	BaseBranch       string // The base branch of the PR, use default branch if not set
	Assignees        []string

	Concurrent             int
	SkipPullRequest        bool     // If set, the script will run directly on the base-branch without creating any PR
	PushOnly               bool     // If set, the script will only publish the feature branch without creating a PR
	SkipRepository         []string // A list of repositories that run will skip
	RegExIncludeRepository *regexp.Regexp
	RegExExcludeRepository *regexp.Regexp

	Fork      bool   // If set, create a fork and make the pull request from it
	ForkOwner string // The owner of the new fork. If empty, the fork should happen on the logged in user

	ConflictStrategy ConflictStrategy // Defines what will happen if a branch already exists

	Draft bool // If set, creates Pull Requests as draft

	Labels   []string // Labels to be added to the pull request
	CloneDir string   // Directory to clone repositories to

	Interactive bool // If set, interactive mode is activated and the user will be asked to verify every change

	CreateGit func(dir string) Git
}

Runner contains fields to be able to do the run

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) error

Run runs a script for multiple repositories and creates PRs with the changes made

type Statuser

type Statuser struct {
	VersionController VersionController

	Output io.Writer

	FeatureBranch string
}

Statuser checks the statuses of pull requests

func (Statuser) Statuses

func (s Statuser) Statuses(ctx context.Context) error

Statuses checks the statuses of pull requests

type VersionController

type VersionController interface {
	GetRepositories(ctx context.Context) ([]scm.Repository, error)
	CreatePullRequest(ctx context.Context, repo scm.Repository, prRepo scm.Repository, newPR scm.NewPullRequest) (scm.PullRequest, error)
	UpdatePullRequest(ctx context.Context, repo scm.Repository, pullReq scm.PullRequest, updatedPR scm.NewPullRequest) (scm.PullRequest, error)
	GetPullRequests(ctx context.Context, branchName string) ([]scm.PullRequest, error)
	GetOpenPullRequest(ctx context.Context, repo scm.Repository, branchName string) (scm.PullRequest, error)
	MergePullRequest(ctx context.Context, pr scm.PullRequest) error
	ClosePullRequest(ctx context.Context, pr scm.PullRequest) error
	ForkRepository(ctx context.Context, repo scm.Repository, newOwner string) (scm.Repository, error)
}

VersionController fetches repositories

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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