Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) CreateIssueComment(ctx context.Context, prID int, comment string) error
- func (c *Client) CreateReviewComment(ctx context.Context, prID int, s *PullRequestComment) error
- func (c *Client) IssueComments(ctx context.Context, prID int) ([]IssueComment, error)
- func (c *Client) ListPullRequestFiles(ctx context.Context, prID int) ([]string, error)
- func (c *Client) OpeningPullRequest(ctx context.Context, branch string) (*PullRequest, error)
- func (c *Client) ReviewComments(ctx context.Context, prID int) ([]PullRequestComment, error)
- func (c *Client) UpdateIssueComment(ctx context.Context, id int, comment string) error
- func (c *Client) UpdateReviewComment(ctx context.Context, id int, body string) error
- type ClientOption
- type IssueComment
- type PullRequest
- type PullRequestComment
- type TriggerEvent
Constants ¶
const DefaultBaseURL = "https://api.github.com"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
ghAPI is an implementation of the SCMClient interface for GitHub Actions.
func NewClient ¶
func NewClient(repo string, opts ...ClientOption) (*Client, error)
githubClient returns a new GitHub client for the given repository. If the GITHUB_TOKEN is set, it will be used for authentication.
func (*Client) CreateIssueComment ¶
func (*Client) CreateReviewComment ¶
func (*Client) IssueComments ¶
func (*Client) ListPullRequestFiles ¶
ListPullRequestFiles return paths of the files in the trigger event pull request.
func (*Client) OpeningPullRequest ¶
OpeningPullRequest returns the latest open pull request for the given branch.
func (*Client) ReviewComments ¶
listReviewComments for the trigger event pull request.
func (*Client) UpdateIssueComment ¶
updateIssueComment updates issue comment with the given id.
type ClientOption ¶
ClientOption is the option when creating a new client.
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
WithBaseURL returns a ClientOption that sets the base URL for the client.
func WithToken ¶
func WithToken(t *oauth2.Token) ClientOption
WithToken returns a ClientOption that sets the token for the client.
type IssueComment ¶
type PullRequestComment ¶
type TriggerEvent ¶
type TriggerEvent struct { PullRequest struct { Number int `mapstructure:"number"` Body string `mapstructure:"body"` URL string `mapstructure:"html_url"` Head struct { SHA string `mapstructure:"sha"` } `mapstructure:"head"` } `mapstructure:"pull_request"` Repository struct { URL string `mapstructure:"html_url"` } `mapstructure:"repository"` }
TriggerEvent is the structure of the GitHub trigger event.
func ExtractEvent ¶
func ExtractEvent(raw map[string]any) (*TriggerEvent, error)
ExtractEvent extracts the trigger event data from the raw event.