one2merge

package
v0.0.0-...-f63246b Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2016 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFileUsed = viper.ConfigFileUsed

ConfigFileUsed contains the function used to get Configuration file used

View Source
var GetString = viper.GetString

GetString contains the function used to lookup environment variables.

View Source
var IsSet = viper.IsSet

IsSet contains the function used to check if key is set

Functions

func CheckFile

func CheckFile() error

CheckFile checks if the configuration file exists and is not empty

func CheckRepositories

func CheckRepositories() error

CheckRepositories checks if the configuration file has repositories

func CheckRepositoriesData

func CheckRepositoriesData(config ConfigRepositoriesChecker) (s string, err error)

CheckRepositoriesData checks if all the repositories have all the parameters set

func Configure

func Configure()

Configure runs all the checks needed for the config file to be set up correctly and prints the repositories available

func Execute

func Execute(DryRun bool) bool

Execute checks if the PR defers to be merged.

func IsMergeable

func IsMergeable(pullRequest *github.PullRequest) bool

IsMergeable returns true if the PullRequest is mergeable.

func Merge

func Merge(client *GHClient, owner string, repo string, number int) (*github.PullRequestMergeResult, error)

Merge does the merge.

func PassedTests

func PassedTests(client *GHClient, pullRequest *github.PullRequest, owner string, repo string) (bool, error)

PassedTests checks if the PR statuses are ok.

Types

type ChangesServicer

ChangesServicer is an interface for listing changes.

type Config

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

Config is a wrapper around Viper

func NewConfig

func NewConfig(viper *viper.Viper) *Config

NewConfig is the constructor for Config.

func (*Config) AllKeys

func (c *Config) AllKeys() []string

AllKeys returns all keys regardless where they are set

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

GetBool returns the value associated with the key as a bool

func (*Config) GetInt

func (c *Config) GetInt(key string) int

GetInt returns the value associated with the key as an integer

func (*Config) GetString

func (c *Config) GetString(key string) string

GetString returns the value associated with the key as a string

func (*Config) GetStringSlice

func (c *Config) GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as an slice of strings

type ConfigRepositoriesChecker

type ConfigRepositoriesChecker interface {
	AllKeys() []string
	GetString(key string) string
}

ConfigRepositoriesChecker is an interface for checking Viper's keys or getting their values

type GHClient

type GHClient struct {
	Changes      ChangesServicer
	Tickets      TicketsServicer
	Repositories RepositoriesServicer
	// contains filtered or unexported fields
}

GHClient is the wrapper around github.Client.

func GetClient

func GetClient() (*GHClient, error)

GetClient returns a github.Client authenticated.

func NewGHClient

func NewGHClient(httpClient *http.Client) *GHClient

NewGHClient is the constructor for GHClient.

type PullRequestInfo

type PullRequestInfo struct {
	Number int // id of the pull request
	Title  string
	Score  int
}

PullRequestInfo contains the id, title, and CR score of a pull request.

func GetPullRequestInfos

func GetPullRequestInfos(client *GHClient, owner string, repo string, allowedUserLogins []string) ([]PullRequestInfo, error)

GetPullRequestInfos returns the list of pull requests and the CR success score based on comments

type RepositoriesServicer

type RepositoriesServicer interface {
	GetCombinedStatus(string, string, string, *github.ListOptions) (*github.CombinedStatus, *github.Response, error)
}

RepositoriesServicer is an interface for listing repositories.

type TicketsServicer

type TicketsServicer interface {
	ListComments(string, string, int, *github.IssueListCommentsOptions) ([]github.IssueComment, *github.Response, error)
}

TicketsServicer is an interface for listing changes.

Jump to

Keyboard shortcuts

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