Documentation
¶
Index ¶
Constants ¶
const (
// HeaderPrefix default prefix for comment message
HeaderPrefix = "## cdk diff for"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.1.2
type Client struct {
Issues IssuesService
Context context.Context
Client *github.Client
Token string
Owner string
Repo string
TagID string
CommentContent string
PullRequestID int
DeleteComments bool
}
Client GitHub client configuration
func NewGithubClient ¶ added in v1.1.2
func NewGithubClient(ctx context.Context, config *config.AppConfig, issuesMock IssuesService) *Client
NewGithubClient create new github client. Can also consume a mocked IssueService
func (*Client) Authenticate ¶ added in v1.1.2
func (gc *Client) Authenticate()
Authenticate authenticate client with github token
func (*Client) FindComment ¶ added in v1.1.2
func (gc *Client) FindComment() (*github.IssueComment, error)
FindComment find the comment which body content start with config.HeaderPrefix "## cdk diff for".
func (*Client) ListComments ¶ added in v1.1.2
func (gc *Client) ListComments() ([]*github.IssueComment, error)
ListComments GitHub API implementation to list all comments of pull request
func (*Client) PostComment ¶ added in v1.1.2
PostComment will create GitHub comment if comment does not exist yet bases on FindComment If the comment already exist the content will be updated. If there are no cdk differences the comment will be deleted depending on DeleteComment config.AppConfig
type IssuesService ¶ added in v1.1.2
type IssuesService interface {
ListComments(ctx context.Context, owner string, repo string, number int, opts *github.IssueListCommentsOptions) ([]*github.IssueComment, *github.Response, error)
DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*github.Response, error)
EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
CreateComment(ctx context.Context, owner string, repo string, number int, comment *github.IssueComment) (*github.IssueComment, *github.Response, error)
}
IssuesService interface for required GitHub actions with API
type NotifierService ¶ added in v1.1.2
type NotifierService interface {
ListComments() ([]*github.IssueComment, error)
FindComment() (*github.IssueComment, error)
PostComment() error
}
NotifierService interface for public methods of GitHub actions required for cdk-notifier