Help us shape the future of Go! Take the 2026 Go Developer Survey

github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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
	Owner    string
	Repo     string
	PR       PullRequest
	CI       string
	Parser   terraform.Parser
	Template 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
	Message  string
	Number   int
}

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