comment

package
v0.0.0-...-5f1eb62 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LastComment

func LastComment(comments []*github.IssueComment, matcher Matcher, deflt *time.Time) *time.Time

LastComment returns the creation date of the last comment that matches. Or deflt if there is no such comment.

Types

type And

type And []Matcher

And makes sure that each match in the list matches (true if empty)

func (And) Match

func (a And) Match(comment *github.IssueComment) bool

Match returns true if all the matcher in the list matches

type Author

type Author github.User

Author matches comment made by this github user.

func (Author) Match

func (a Author) Match(comment *github.IssueComment) bool

Match if the Author is a match.

type AuthorLogin

type AuthorLogin string

AuthorLogin matches comment made by this Author

func (AuthorLogin) Match

func (a AuthorLogin) Match(comment *github.IssueComment) bool

Match if the Author is a match (ignoring case)

type Command

type Command struct {
	Name      string
	Arguments string
}

Command is a way for human to interact with the bot

func ParseCommand

func ParseCommand(comment *github.IssueComment) *Command

ParseCommand attempts to read a command from a comment Returns nil if the comment doesn't contain a command

func (*Command) String

func (n *Command) String() string

String displays the command

type CommandArguments

type CommandArguments regexp.Regexp

CommandArguments identifies commands by arguments (with regex)

func (CommandArguments) Match

func (c CommandArguments) Match(comment *github.IssueComment) bool

Match if the command arguments match the regexp

type CommandName

type CommandName string

CommandName identifies commands by name

func (CommandName) Match

func (c CommandName) Match(comment *github.IssueComment) bool

Match will return true if the comment is a command with the given name

type CreatedAfter

type CreatedAfter time.Time

CreatedAfter matches comments created after the time

func (CreatedAfter) Match

func (c CreatedAfter) Match(comment *github.IssueComment) bool

Match returns true if the comment is created after the time

type CreatedBefore

type CreatedBefore time.Time

CreatedBefore matches comments created before the time

func (CreatedBefore) Match

func (c CreatedBefore) Match(comment *github.IssueComment) bool

Match returns true if the comment is created before the time

type False

type False struct{}

False is a matcher that is always false

func (False) Match

func (t False) Match(comment *github.IssueComment) bool

Match returns false no matter what

type FilteredComments

type FilteredComments []*github.IssueComment

FilteredComments is a list of comments

func FilterComments

func FilterComments(comments []*github.IssueComment, matcher Matcher) FilteredComments

FilterComments will return the list of matching comments

func (FilteredComments) Empty

func (f FilteredComments) Empty() bool

Empty Checks to see if the list of comments is empty

func (FilteredComments) GetLast

func (f FilteredComments) GetLast() *github.IssueComment

GetLast returns the last comment in a series of comments

type Matcher

type Matcher interface {
	Match(comment *github.IssueComment) bool
}

Matcher is an interface to match a comment

func BotAuthor

func BotAuthor() Matcher

BotAuthor creates a matcher to find any bot comments

func HumanActor

func HumanActor() Matcher

HumanActor creates a matcher to find non-bot comments. ValidAuthor is used because a comment that doesn't have "Author" is NOT made by a human

func JenkinsBotAuthor

func JenkinsBotAuthor() Matcher

JenkinsBotAuthor creates a matcher to find jenkins bot comments

func MungeBotAuthor

func MungeBotAuthor() Matcher

MungeBotAuthor creates a matcher to find mungebot comments

func MungerNotificationName

func MungerNotificationName(notif string) Matcher

MungerNotificationName finds notification posted by the munger, based on name

type Not

type Not struct {
	Matcher Matcher
}

Not reverses the effect of the matcher

func (Not) Match

func (n Not) Match(comment *github.IssueComment) bool

Match returns true if the matcher would return false, and vice-versa

type Notification

type Notification struct {
	Name      string
	Arguments string
	Context   string
}

Notification is a message sent by the bot. Easy to find and create.

func ParseNotification

func ParseNotification(comment *github.IssueComment) *Notification

ParseNotification attempts to read a notification from a comment Returns nil if the comment doesn't contain a notification Also note that Context is not parsed from the notification

func (Notification) Post

func (n Notification) Post(obj *mgh.MungeObject) error

Post a new notification on Github

func (*Notification) String

func (n *Notification) String() string

String converts the notification

type NotificationName

type NotificationName string

NotificationName identifies notifications by name

func (NotificationName) Match

func (b NotificationName) Match(comment *github.IssueComment) bool

Match returns true if the comment is a notification with the given name

type Or

type Or []Matcher

Or makes sure that at least one element in the list matches (false if empty)

func (Or) Match

func (o Or) Match(comment *github.IssueComment) bool

Match returns true if one of the matcher in the list matches

type Pinger

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

Pinger checks if it's time to send a ping. You can build a pinger for a specific use-case and re-use it when you want.

func NewPinger

func NewPinger(keyword string) *Pinger

NewPinger creates a new pinger. `keyword` is the name of the notification.

func (*Pinger) IsMaxReached

func (p *Pinger) IsMaxReached(comments []*github.IssueComment, startDate *time.Time) bool

IsMaxReached tells you if you've reached the limit yet

func (*Pinger) PingNotification

func (p *Pinger) PingNotification(comments []*github.IssueComment, who string, startDate *time.Time) *Notification

PingNotification creates a new notification to ping `who`

func (*Pinger) SetDescription

func (p *Pinger) SetDescription(description string) *Pinger

SetDescription is the description that goes along the ping

func (*Pinger) SetMaxCount

func (p *Pinger) SetMaxCount(maxCount int) *Pinger

SetMaxCount will make the pinger fail when it reaches maximum

func (*Pinger) SetTimePeriod

func (p *Pinger) SetTimePeriod(timePeriod time.Duration) *Pinger

SetTimePeriod is the time we wait between pings

type True

type True struct{}

True is a matcher that is always true

func (True) Match

func (t True) Match(comment *github.IssueComment) bool

Match returns true no matter what

type ValidAuthor

type ValidAuthor struct{}

ValidAuthor validates that a comment has the author set

func (ValidAuthor) Match

func (ValidAuthor) Match(comment *github.IssueComment) bool

Match if the comment has a valid author

Jump to

Keyboard shortcuts

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