Documentation ¶
Index ¶
- func GetToken(c *configuration.Config) string
- func HasAllLabels(labels []string, issueLabels []github.Label) bool
- func HasAnyLabels(labels []string, issueLabels []github.Label) bool
- func HasFailingCILabel(labels []github.Label) bool
- func HasLabel(label string, issueLabels []github.Label) bool
- type Client
- type DefaultClient
- type IssuesService
- type Item
- func (i Item) Assignee() *github.User
- func (i Item) Assignees() []*github.User
- func (i Item) Body() string
- func (i *Item) GetRelatedIssue(client Client) (*github.Issue, error)
- func (i Item) IsIssue() bool
- func (i Item) IsNil() bool
- func (i Item) IsPullRequest() bool
- func (i *Item) Number() int
- func (i *Item) Repository() string
- func (i *Item) Title() string
- func (i *Item) Type() string
- func (i *Item) User() *github.User
- type PullRequestsService
- type RepoStatus
- type RepositoriesService
- type SearchService
- type StatusSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetToken ¶
func GetToken(c *configuration.Config) string
GetToken returns the GitHub API token to use.
func HasAllLabels ¶
HasAllLabels returns true if a collection of labels contains all of the specified collection of labels.
func HasAnyLabels ¶
HasAnyLabels returns true if a collection of labels contains any of the specified collection of labels.
func HasFailingCILabel ¶
HasFailingCILabel returns true if a collection of labels contains the particular label indicating test failures.
Types ¶
type Client ¶
type Client interface { Issues() IssuesService PullRequests() PullRequestsService Repositories() RepositoriesService Search() SearchService }
Client allows us to wrap the use of the go-github library in order to be able to mock it in tests.
func MakeClient ¶
func MakeClient(c *configuration.Config) Client
MakeClient returns a new client instance for the specified configuration.
type DefaultClient ¶
DefaultClient is the default implementation for a GitHub client.
func (DefaultClient) Issues ¶
func (d DefaultClient) Issues() IssuesService
Issues returns the issue service instance.
func (DefaultClient) PullRequests ¶
func (d DefaultClient) PullRequests() PullRequestsService
PullRequests returns the pull request service instance.
func (DefaultClient) Repositories ¶
func (d DefaultClient) Repositories() RepositoriesService
Repositories returns the repository service instance.
func (DefaultClient) Search ¶
func (d DefaultClient) Search() SearchService
Search returns the search service instance.
type IssuesService ¶
type IssuesService interface { // Issue API. AddAssignees(owner string, repo string, number int, assignees []string) (*github.Issue, *github.Response, error) Edit(owner string, repo string, number int, issue *github.IssueRequest) (*github.Issue, *github.Response, error) Get(owner string, repo string, number int) (*github.Issue, *github.Response, error) ListByRepo(owner string, repo string, opt *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) // Comments API. CreateComment(owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error) DeleteComment(owner string, repo string, id int) (*github.Response, error) ListComments(owner string, repo string, number int, opt *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error) // Label API. AddLabelsToIssue(owner string, repo string, number int, labels []string) ([]*github.Label, *github.Response, error) RemoveLabelForIssue(owner string, repo string, number int, label string) (*github.Response, error) // Milestones API. ListMilestones(owner string, repo string, opt *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) }
IssuesService is the interface to the GitHub issue service.
type Item ¶
type Item struct { Issue *github.Issue PullRequest *github.PullRequest }
Item is a union type that can encapsulate either a github.Issue or a github.PullRequest. This allows to have a single Operation interface and let the implementation handle according to its capabilities.
func MakeIssueItem ¶
MakeIssueItem create an Item wrapper around a GitHub issue.
func MakePullRequestItem ¶
func MakePullRequestItem(pullRequest *github.PullRequest) Item
MakePullRequestItem create an Item wrapper around a GitHub pull request.
func (*Item) GetRelatedIssue ¶
GetRelatedIssue retrieves and return the GitHub issue related to a pull request. This function will fail when called on a GitHub issue.
func (Item) IsIssue ¶
IsIssue returns whether the item is strictly a GitHub issue (i.e., not the issue object of a corresponding pull request).
func (Item) IsPullRequest ¶
IsPullRequest returns whether the item is a GitHub pull request.
func (*Item) Repository ¶
Repository returns the repository full name of the item. In the case of a pull request, this is the destination repository.
type PullRequestsService ¶
type PullRequestsService interface { // Pull requests API. Get(owner string, repo string, number int) (*github.PullRequest, *github.Response, error) List(owner string, repo string, opt *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) ListFiles(owner string, repo string, number int, opt *github.ListOptions) ([]*github.CommitFile, *github.Response, error) // Commits API. ListCommits(owner string, repo string, number int, opt *github.ListOptions) ([]*github.RepositoryCommit, *github.Response, error) }
PullRequestsService is the interface to the GitHub pull request service.
type RepoStatus ¶
RepoStatus is the status of a repository at a particular reference.
type RepositoriesService ¶
type RepositoriesService interface { // Statuses API. CreateStatus(owner, repo, ref string, sts *github.RepoStatus) (*github.RepoStatus, *github.Response, error) ListStatuses(owner, repo, ref string, opt *github.ListOptions) ([]*github.RepoStatus, *github.Response, error) }
RepositoriesService is the interface to the GitHub repositories service.
type SearchService ¶
type SearchService interface {
Issues(query string, opt *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error)
}
SearchService is the interface to the GitHub search service.
type StatusSnapshot ¶
type StatusSnapshot map[string]RepoStatus
StatusSnapshot is a collection of statuses indexed by the corresponding configuration name.
func GetLatestStatuses ¶
func GetLatestStatuses(statuses []*github.RepoStatus) StatusSnapshot
GetLatestStatuses returns the selection of the latest status for each configuration.
func (*StatusSnapshot) HasFailures ¶
func (s *StatusSnapshot) HasFailures() bool
HasFailures returns any whether any of the statuses are in a failed state.