mungerutil

package
v0.0.0-...-d802ca6 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BotName is the name of merge-bot
	BotName = "k8s-merge-robot"
)

Variables

This section is empty.

Functions

func GetHash

func GetHash(fileContents []byte) string

GetHash returns SHA1 hash of a byte array.

func IsMungeBot

func IsMungeBot(u *github.User) bool

IsMungeBot returns true only if given user is this bot.

func IsValidUser

func IsValidUser(u *github.User) bool

IsValidUser returns true only if given user has valid github username.

func PrettyMarshal

func PrettyMarshal(data interface{}) []byte

PrettyMarshal creates pretty marshaled bytes from a structure.

func PrettyString

func PrettyString(data interface{}) string

PrettyString is used by logging functions to get a readable version of a struct.

Types

type FirstLabelTimeGetter

type FirstLabelTimeGetter interface {
	FirstLabelTime(label string) *time.Time
	Number() int
}

FirstLabelTimeGetter represents anything that can get a label's first time. (interface is for testability / reduced import tree.)

type IssueUsers

type IssueUsers struct {
	Assignees UserSet
	Author    UserSet // This will usually be one or zero
}

IssueUsers tracks Users involved in a github Issue

func GetIssueUsers

func GetIssueUsers(issue *github.Issue) *IssueUsers

GetIssueUsers creates a new IssueUsers object from an issue's fields

func (*IssueUsers) AllUsers

func (u *IssueUsers) AllUsers() UserSet

AllUsers return a list of unique users (both assignees and author)

type LabelTimeCache

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

LabelTimeCache just caches the result of a time lookup, since the first time a label is applied never changes.

func NewLabelTimeCache

func NewLabelTimeCache(label string) *LabelTimeCache

NewLabelTimeCache constructs a label time cache for the given label.

func (*LabelTimeCache) FirstLabelTime

func (c *LabelTimeCache) FirstLabelTime(obj FirstLabelTimeGetter) (time.Time, bool)

FirstLabelTime returns a time from the cache if possible. Otherwise, it will look up the time. If that doesn't work either, it will return (time.Time{}, false).

type UserSet

type UserSet sets.String

UserSet is a set a of users

func GetUsers

func GetUsers(users ...*github.User) UserSet

GetUsers returns a UserSet

func (UserSet) Has

func (u UserSet) Has(user ...*github.User) bool

Has tells you if the users can be found in the set

func (UserSet) Join

func (u UserSet) Join() string

Join joins each users into a single string

func (UserSet) List

func (u UserSet) List() []string

List makes a list from the set

func (UserSet) Mention

func (u UserSet) Mention() UserSet

Mention adds @ to user in the list who don't have it yet

Jump to

Keyboard shortcuts

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