github

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EnvBaseURL = "GITHUB_BASE_URL"

EnvBaseURL is GitHub base URL. This can be set to a domain endpoint to use with GitHub Enterprise.

View Source
const EnvToken = "GITHUB_TOKEN"

EnvToken is GitHub API Token

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	IssuesCreateComment(ctx context.Context, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
	IssuesDeleteComment(ctx context.Context, commentID int64) (*github.Response, error)
	IssuesListComments(ctx context.Context, number int, opt *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)
	RepositoriesCreateComment(ctx context.Context, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error)
	RepositoriesListCommits(ctx context.Context, opt *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
}

API is GitHub API interface

type Client

type Client struct {
	*github.Client
	Debug bool

	Config Config

	Comment *CommentService
	Commits *CommitsService
	Notify  *NotifyService

	API API
	// contains filtered or unexported fields
}

Client is a API client for GitHub

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient returns Client initialized with Config

type CommentService

type CommentService service

CommentService handles communication with the comment related methods of GitHub API

func (*CommentService) Delete

func (g *CommentService) Delete(id int) error

Delete deletes comment on GitHub issues/pull requests

func (*CommentService) DeleteDuplicates

func (g *CommentService) DeleteDuplicates(title string)

DeleteDuplicates deletes duplicate comments containing arbitrary character strings

func (*CommentService) List

func (g *CommentService) List(number int) ([]*github.IssueComment, error)

List lists comments on GitHub issues/pull requests

func (*CommentService) Post

func (g *CommentService) Post(body string, opt PostOptions) error

Post posts comment

type CommitsService

type CommitsService service

CommitsService handles communication with the commits related methods of GitHub API

func (*CommitsService) List

func (g *CommitsService) List(revision string) ([]string, error)

List lists commits on a repository

type Config

type Config struct {
	Token       string
	BaseURL     string
	Owner       string
	Repo        string
	PR          PullRequest
	CI          string
	Parser      terraform.Parser
	WarnDestroy bool
	// Template is used for all Terraform command output
	Template terraform.Template
	// DestroyWarningTemplate is used only for additional warning
	// the plan result contains destroy operation
	DestroyWarningTemplate terraform.Template
}

Config is a configuration for GitHub client

type GitHub

type GitHub struct {
	*github.Client
	// contains filtered or unexported fields
}

GitHub represents the attribute information necessary for requesting GitHub API

func (*GitHub) IssuesCreateComment

func (g *GitHub) IssuesCreateComment(ctx context.Context, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)

IssuesCreateComment is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.CreateComment

func (*GitHub) IssuesDeleteComment

func (g *GitHub) IssuesDeleteComment(ctx context.Context, commentID int64) (*github.Response, error)

IssuesDeleteComment is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.DeleteComment

type NotifyService

type NotifyService service

NotifyService handles communication with the notification related methods of GitHub API

func (*NotifyService) Notify

func (g *NotifyService) Notify(body string) (exit int, err error)

Notify posts comment optimized for notifications

type PostOptions

type PostOptions struct {
	Number   int
	Revision string
}

PostOptions specifies the optional parameters to post comments to a pull request

type PullRequest

type PullRequest struct {
	Revision              string
	Title                 string
	Message               string
	Number                int
	DestroyWarningTitle   string
	DestroyWarningMessage string
}

PullRequest represents GitHub Pull Request metadata

func (*PullRequest) IsNumber

func (pr *PullRequest) IsNumber() bool

IsNumber returns true if PullRequest is Pull Request build

Jump to

Keyboard shortcuts

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