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) IssuesEditComment(ctx context.Context, commentID int64, comment *github.IssueComment) (*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) IssuesUpdateLabel(ctx context.Context, label, color string) (*github.Label, *github.Response, error)
- func (g *GitHub) PullRequestsListPullRequestsWithCommit(ctx context.Context, sha string, opt *github.ListOptions) ([]*github.PullRequest, *github.Response, error)
- func (g *GitHub) RepositoriesCreateComment(ctx context.Context, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error)
- type IssueComment
- type ListOptions
- type Metadata
- type NotifyService
- type PostOptions
- type PullRequest
- type ResultLabels
- type UserService
Constants ¶
const EnvBaseURL = "GITHUB_BASE_URL"
EnvBaseURL is GitHub base URL. This can be set to a domain endpoint to use with GitHub Enterprise.
const EnvToken = "GITHUB_TOKEN" //nolint:gosec
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) IssuesEditComment(ctx context.Context, commentID int64, comment *github.IssueComment) (*github.IssueComment, *github.Response, error) IssuesListLabels(ctx context.Context, number int, opt *github.ListOptions) ([]*github.Label, *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) IssuesUpdateLabel(ctx context.Context, label, color string) (*github.Label, *github.Response, error) RepositoriesCreateComment(ctx context.Context, sha string, comment *github.RepositoryComment) (*github.RepositoryComment, *github.Response, error) PullRequestsListPullRequestsWithCommit(ctx context.Context, sha string, opt *github.ListOptions) ([]*github.PullRequest, *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 User *UserService 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) List ¶
func (g *CommentService) List(ctx context.Context, owner, repo string, number int) ([]*IssueComment, error)
func (*CommentService) Post ¶
func (g *CommentService) Post(ctx context.Context, body string, opt *PostOptions) error
Post posts comment
type CommitsService ¶
type CommitsService service
CommitsService handles communication with the commits related methods of GitHub API
type Config ¶
type Config struct { Token string BaseURL string GraphQLEndpoint string Owner string Repo string PR PullRequest CI string Parser terraform.Parser // Template is used for all Terraform command output Template *terraform.Template ParseErrorTemplate *terraform.Template // ResultLabels is a set of labels to apply depending on the plan result ResultLabels ResultLabels Vars map[string]string EmbeddedVarNames []string Templates map[string]string UseRawOutput bool Patch bool SkipNoChanges bool }
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) IssuesEditComment ¶
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) IssuesUpdateLabel ¶
func (g *GitHub) IssuesUpdateLabel(ctx context.Context, label, color string) (*github.Label, *github.Response, error)
IssuesUpdateLabel is a wrapper of https://pkg.go.dev/github.com/google/go-github/github#IssuesService.EditLabel
func (*GitHub) PullRequestsListPullRequestsWithCommit ¶
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
type IssueComment ¶
type ListOptions ¶
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 ¶
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 AddOrUpdateLabelColor string DestroyLabelColor string NoChangesLabelColor string PlanErrorLabelColor 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
type UserService ¶
type UserService service