github

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Provider = "github"

Variables

View Source
var (
	// ErrGitHubAPI signals an error while making a request to the GitHub API.
	ErrGitHubAPI = errors.NewKind("github api error")
	// ErrEventNotSupported signals that this provider does not support the
	// given event for a given operation.
	ErrEventNotSupported = errors.NewKind("event not supported")
)
View Source
var (
	NoErrNotModified       = errors.NewKind("Not modified")
	ErrParsingEventPayload = errors.NewKind("Parse error in event")

	// RequestTimeout is the max time to wait until the request context is
	// cancelled.
	RequestTimeout = time.Second * 5
)
View Source
var (
	ErrLineOutOfDiff = errors.NewKind("line number is not in diff")
)

Functions

This section is empty.

Types

type CommitsComparator

type CommitsComparator interface {
	// CompareCommits compare two commits.
	CompareCommits(ctx context.Context, owner, repo string, base, head string) (
		*github.CommitsComparison, *github.Response, error)
}

CommitsComparator compares commits on GitHub. *github.RepositoriesService fulfills this interface.

type Poster

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

Poster posts comments as Pull Request Reviews.

func NewPoster

func NewPoster(t http.RoundTripper, conf ProviderConfig) *Poster

NewPoster creates a new poster for the GitHub API.

func (*Poster) Post

func (p *Poster) Post(ctx context.Context, e lookout.Event,
	aCommentsList []lookout.AnalyzerComments) error

Post posts comments as a Pull Request Review. If the event is not a GitHub Pull Request, ErrEventNotSupported is returned. If a GitHub API request fails, ErrGitHubAPI is returned.

func (*Poster) Status added in v0.0.3

func (p *Poster) Status(ctx context.Context, e lookout.Event, status lookout.AnalysisStatus) error

Status sets the Pull Request global status, visible from the GitHub UI

type ProviderConfig added in v0.0.4

type ProviderConfig struct {
	CommentFooter string `yaml:"comment_footer"`
}

ProviderConfig represents the yml config

type ReviewCreator

type ReviewCreator interface {
	// CreateReview creates a new code review on a GitHub pull request.
	CreateReview(ctx context.Context, owner, repo string,
		number int, review *github.PullRequestReviewRequest) (
		*github.PullRequestReview, *github.Response, error)
}

ReviewCreator can create code reviews on GitHub. *github.PullRequestsService fulfills this interface.

type StatusCreator added in v0.0.3

type StatusCreator interface {
	// CreateStatus creates a new status for a repository at the specified
	// reference. Ref can be a SHA, a branch name, or a tag name.
	CreateStatus(ctx context.Context, owner, repo, ref string, status *github.RepoStatus) (
		*github.RepoStatus, *github.Response, error)
}

StatusCreator creates statuses on GitHub. *github.RepositoriesService fulfills this interface.

type Watcher

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

func NewWatcher

func NewWatcher(transport http.RoundTripper, o *lookout.WatchOptions) (*Watcher, error)

NewWatcher returns a new

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context, cb lookout.EventHandler) error

Watch start to make request to the GitHub API and return the new events.

Jump to

Keyboard shortcuts

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