Documentation ¶
Overview ¶
hubbub provides an advanced in-memory search for GitHub using state machines
Index ¶
- Constants
- func NeedsClosed(fs []Filter) bool
- func ParseDuration(ds string) (time.Duration, bool, bool)
- type Comment
- type Config
- type Conversation
- type Engine
- func (h *Engine) FindSimilar(co *Conversation) []*RelatedConversation
- func (h *Engine) IssueSummary(i *github.Issue, cs []*github.IssueComment, age time.Time) *Conversation
- func (h *Engine) PRSummary(ctx context.Context, pr *github.PullRequest, cs []*Comment, ...) *Conversation
- func (h *Engine) SearchAny(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- func (h *Engine) SearchIssues(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- func (h *Engine) SearchPullRequests(ctx context.Context, org string, project string, fs []Filter, ...) ([]*Conversation, time.Time, error)
- type Filter
- func (f *Filter) LabelNegate() bool
- func (f *Filter) LabelRegex() *regexp.Regexp
- func (f *Filter) LoadLabelRegex() error
- func (f *Filter) LoadMilestoneRegex() error
- func (f *Filter) LoadTagRegex() error
- func (f *Filter) LoadTitleRegex() error
- func (f *Filter) MilestoneNegate() bool
- func (f *Filter) MilestoneRegex() *regexp.Regexp
- func (f *Filter) TagNegate() bool
- func (f *Filter) TagRegex() *regexp.Regexp
- func (f *Filter) TitleNegate() bool
- func (f *Filter) TitleRegex() *regexp.Regexp
- type GitHubComment
- type GitHubItem
- type RelatedConversation
Constants ¶
const ( Unreviewed = "UNREVIEWED" NewCommits = "NEW_COMMITS" ChangesRequested = "CHANGES_REQUESTED" Approved = "APPROVED" PushedAfterApproval = "PUSHED_AFTER_APPROVAL" Commented = "COMMENTED" Merged = "MERGED" Closed = "CLOSED" )
const Issue = "issue"
Issue is a type representing an issue
const PullRequest = "pull_request"
PullRequest is a type representing a PR
Variables ¶
This section is empty.
Functions ¶
func NeedsClosed ¶
NeedsClosed returns whether or not the filters require closed items
Types ¶
type Comment ¶ added in v1.2.0
type Comment struct { User *github.User Created time.Time Updated time.Time Body string AuthorAssoc string Reactions *github.Reactions ReviewID int64 }
Comment is a loose internal comment structure matching issue, PR, code review comments
func NewComment ¶ added in v1.2.0
func NewComment(g GitHubComment) *Comment
type Config ¶
type Config struct { Client *github.Client // Client is a GitHub client Cache persist.Cacher // Cacher is a cache interface Repos []string // Repos is the repositories to search // MinSimilarity is how close two items need to be to each other to be called similar MinSimilarity float64 // The furthest we will query back for information on closed issues MaxClosedUpdateAge time.Duration // DebugNumbers is used when you want to debug why a single item is being handled in a certain wait DebugNumbers map[int]bool // MemberRoles are which roles to consider as members // https://developer.github.com/v4/enum/commentauthorassociation/ MemberRoles []string // Members are which specific users to consider as members Members []string }
Config is how to configure a new hubbub engine
type Conversation ¶
type Conversation struct { ID int `json:"id"` Organization string `json:"organization"` Project string `json:"project"` URL string `json:"url"` Title string `json:"title"` Author *github.User `json:"author"` Type string `json:"type"` State string `json:"state"` Created time.Time `json:"created"` // Latest comment or event Updated time.Time `json:"updated"` // Seen is the time we last saw this conversation Seen time.Time `json:"seen"` // When did this item reach the current priority? Prioritized time.Time `json:"prioritized"` SelfInflicted bool `json:"self_inflicted"` ReviewState string `json:"review_state"` LatestAuthorResponse time.Time `json:"latest_author_response"` LatestAssigneeResponse time.Time `json:"latest_assignee_response"` LatestMemberResponse time.Time `json:"latest_member_response"` AccumulatedHoldTime time.Duration `json:"accumulated_hold_time"` CurrentHoldTime time.Duration `json:"current_hold_time"` Assignees []*github.User `json:"assignees"` Labels []*github.Label `json:"labels"` ReactionsTotal int `json:"reactions_total"` Reactions map[string]int `json:"reactions"` ReactionsPerMonth float64 `json:"reactions_per_month"` Commenters []*github.User `json:"commenters"` LastCommentBody string `json:"last_comment_body"` LastCommentAuthor *github.User `json:"last_comment_author"` CommentsTotal int `json:"comments_total"` CommentersTotal int `json:"commenters_total"` CommentersPerMonth float64 `json:"commenters_per_month"` ClosedCommentsTotal int `json:"closed_comments_total"` ClosedCommentersTotal int `json:"closed_commenters_total"` ClosedAt time.Time `json:"closed_at"` ClosedBy *github.User `json:"closed_by"` TimelineTotal int `json:"timeline_total"` ReviewsTotal int `json:"reviews_total"` IssueRefs []*RelatedConversation `json:"issue_refs"` PullRequestRefs []*RelatedConversation `json:"pull_request_refs"` Tags []tag.Tag `json:"tags"` // Similar issues to this one Similar []*RelatedConversation `json:"similar"` Milestone *github.Milestone `json:"milestone"` }
Conversation represents a discussion within a GitHub item (issue or PR)
func (*Conversation) UpdateIssueRefs ¶ added in v1.2.0
func (co *Conversation) UpdateIssueRefs(rc *RelatedConversation)
UpdateIssueRefs updates referenced issues within a conversation, adding it if necessary
func (*Conversation) UpdatePullRequestRefs ¶ added in v1.2.0
func (co *Conversation) UpdatePullRequestRefs(rc *RelatedConversation)
UpdatePullRequestRefs updates referenced PR's within a conversation, adding it if necessary
type Engine ¶
type Engine struct { // Must be settable from config MinSimilarity float64 // The furthest we will query back for information on closed issues MaxClosedUpdateAge time.Duration // contains filtered or unexported fields }
Engine is the search engine interface for hubbub
func (*Engine) FindSimilar ¶
func (h *Engine) FindSimilar(co *Conversation) []*RelatedConversation
FindSimilar locates similar conversations to this one
func (*Engine) IssueSummary ¶
func (h *Engine) IssueSummary(i *github.Issue, cs []*github.IssueComment, age time.Time) *Conversation
IssueSummary returns a cached conversation for an issue
func (*Engine) PRSummary ¶
func (h *Engine) PRSummary(ctx context.Context, pr *github.PullRequest, cs []*Comment, timeline []*github.Timeline, reviews []*github.PullRequestReview, age time.Time, fetch bool) *Conversation
func (*Engine) SearchAny ¶
func (h *Engine) SearchAny(ctx context.Context, org string, project string, fs []Filter, newerThan time.Time, hidden bool) ([]*Conversation, time.Time, error)
Search for GitHub issues or PR's
type Filter ¶
type Filter struct { RawLabel string `yaml:"label,omitempty"` RawTag string `yaml:"tag,omitempty"` RawTitle string `yaml:"title,omitempty"` RawMilestone string `yaml:"milestone,omitempty"` Created string `yaml:"created,omitempty"` Updated string `yaml:"updated,omitempty"` Closed string `yaml:"closed,omitempty"` Prioritized string `yaml:"prioritized,omitempty"` Responded string `yaml:"responded,omitempty"` Reactions string `yaml:"reactions,omitempty"` ReactionsPerMonth string `yaml:"reactions-per-month,omitempty"` Comments string `yaml:"comments,omitempty"` Commenters string `yaml:"commenters,omitempty"` CommentersPerMonth string `yaml:"commenters-per-month,omitempty"` ClosedComments string `yaml:"comments-while-closed,omitempty"` ClosedCommenters string `yaml:"commenters-while-closed,omitempty"` State string `yaml:"state,omitempty"` // contains filtered or unexported fields }
Filter lets you do less.
func (*Filter) LabelNegate ¶
func (*Filter) LabelRegex ¶
func (*Filter) LoadLabelRegex ¶
LoadLabelRegex loads a new label reegx
func (*Filter) LoadMilestoneRegex ¶ added in v1.2.0
LoadMilestoneRegex loads a new milestone regex
func (*Filter) LoadTagRegex ¶
LoadTagRegex loads a new tag regex
func (*Filter) LoadTitleRegex ¶
LoadTitleRegex loads a new title regex
func (*Filter) MilestoneNegate ¶ added in v1.2.0
func (*Filter) MilestoneRegex ¶ added in v1.2.0
func (*Filter) TitleNegate ¶
func (*Filter) TitleRegex ¶
type GitHubComment ¶ added in v1.2.0
type GitHubComment interface { GetAuthorAssociation() string GetBody() string GetCreatedAt() time.Time GetReactions() *github.Reactions GetHTMLURL() string GetID() int64 GetURL() string GetUpdatedAt() time.Time GetUser() *github.User String() string }
GitHubComment is an interface that matches both GitHub issues and pull review comments
type GitHubItem ¶
type GitHubItem interface { GetAssignee() *github.User GetAuthorAssociation() string GetBody() string GetComments() int GetHTMLURL() string GetCreatedAt() time.Time GetID() int64 GetMilestone() *github.Milestone GetNumber() int GetClosedAt() time.Time GetState() string GetTitle() string GetURL() string GetUpdatedAt() time.Time GetUser() *github.User String() string }
GitHubItem is an interface that matches both GitHub Issues and PullRequests
type RelatedConversation ¶
type RelatedConversation struct { Organization string `json:"org"` Project string `json:"project"` ID int `json:"int"` Tags []tag.Tag `json:"tags"` URL string `json:"url"` Title string `json:"title"` Author *github.User `json:"author"` Type string `json:"type"` State string `json:"state"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` Seen time.Time `json:"seen"` ReviewState string `json:"review_state"` }
A subset of Conversation for related items (requires less memory than a Conversation)