Documentation ¶
Index ¶
- Constants
- type API
- type Client
- type CommentService
- type CommitsService
- type Config
- type GitHub
- func (g *GitHub) IssuesAddLabels(ctx context.Context, number int, labels []string) ([]*github.Label, *github.Response, error)
- func (g *GitHub) IssuesCreateComment(ctx context.Context, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
- func (g *GitHub) IssuesDeleteComment(ctx context.Context, commentID int64) (*github.Response, error)
- func (g *GitHub) IssuesListComments(ctx context.Context, number int, opt *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)
- func (g *GitHub) IssuesListLabels(ctx context.Context, number int, opt *github.ListOptions) ([]*github.Label, *github.Response, error)
- func (g *GitHub) IssuesRemoveLabel(ctx context.Context, number int, label string) (*github.Response, error)
- func (g *GitHub) RepositoriesCreateComment(ctx context.Context, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error)
- func (g *GitHub) RepositoriesGetCommit(ctx context.Context, sha string) (*github.RepositoryCommit, *github.Response, error)
- func (g *GitHub) RepositoriesListCommits(ctx context.Context, opt *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
- type NotifyService
- type PostOptions
- type PullRequest
- type ResultLabels
Constants ¶
const EnvBaseURL = "GITHUB_BASE_URL"
EnvBaseURL is GitHub base URL. This can be set to a domain endpoint to use with GitHub Enterprise.
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) IssuesListLabels(ctx context.Context, number int, opt *github.ListOptions) ([]*github.Label, *github.Response, error) IssuesListComments(ctx context.Context, number int, opt *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error) IssuesAddLabels(ctx context.Context, number int, labels []string) ([]*github.Label, *github.Response, error) IssuesRemoveLabel(ctx context.Context, number int, label string) (*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) RepositoriesGetCommit(ctx context.Context, sha string) (*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
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
func (*CommitsService) MergedPRNumber ¶
func (g *CommitsService) MergedPRNumber(revision string) (int, error)
type Config ¶
type Config struct { Token string BaseURL string Owner string Repo string PR PullRequest CI string Parser terraform.Parser UseRawOutput bool 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 // ResultLabels is a set of labels to apply depending on the plan result ResultLabels ResultLabels }
Config is a configuration for GitHub client
type GitHub ¶
GitHub represents the attribute information necessary for requesting GitHub API
func (*GitHub) IssuesAddLabels ¶
func (g *GitHub) IssuesAddLabels(ctx context.Context, number int, labels []string) ([]*github.Label, *github.Response, error)
IssuesAddLabels is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.AddLabelsToIssue
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
func (*GitHub) IssuesListComments ¶
func (g *GitHub) IssuesListComments(ctx context.Context, number int, opt *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)
IssuesListComments is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.ListComments
func (*GitHub) IssuesListLabels ¶
func (g *GitHub) IssuesListLabels(ctx context.Context, number int, opt *github.ListOptions) ([]*github.Label, *github.Response, error)
IssuesListLabels is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.ListLabelsByIssue
func (*GitHub) IssuesRemoveLabel ¶
func (g *GitHub) IssuesRemoveLabel(ctx context.Context, number int, label string) (*github.Response, error)
IssuesRemoveLabel is a wrapper of https://godoc.org/github.com/google/go-github/github#IssuesService.RemoveLabelForIssue
func (*GitHub) RepositoriesCreateComment ¶
func (g *GitHub) RepositoriesCreateComment(ctx context.Context, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error)
RepositoriesCreateComment is a wrapper of https://godoc.org/github.com/google/go-github/github#RepositoriesService.CreateComment
func (*GitHub) RepositoriesGetCommit ¶
func (g *GitHub) RepositoriesGetCommit(ctx context.Context, sha string) (*github.RepositoryCommit, *github.Response, error)
RepositoriesGetCommit is a wrapper of https://godoc.org/github.com/google/go-github/github#RepositoriesService.GetCommit
func (*GitHub) RepositoriesListCommits ¶
func (g *GitHub) RepositoriesListCommits(ctx context.Context, opt *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
RepositoriesListCommits is a wrapper of https://godoc.org/github.com/google/go-github/github#RepositoriesService.ListCommits
type NotifyService ¶
type NotifyService service
NotifyService handles communication with the notification related methods of GitHub API
type PostOptions ¶
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
type ResultLabels ¶
type ResultLabels struct { AddOrUpdateLabel string DestroyLabel string NoChangesLabel string PlanErrorLabel string }
ResultLabels represents the labels to add to the PR depending on the plan result
func (*ResultLabels) HasAnyLabelDefined ¶
func (r *ResultLabels) HasAnyLabelDefined() bool
HasAnyLabelDefined returns true if any of the internal labels are set
func (*ResultLabels) IsResultLabel ¶
func (r *ResultLabels) IsResultLabel(label string) bool
IsResultLabel returns true if a label matches any of the internal labels