Documentation
¶
Overview ¶
Package review provides a high-level API for GitHub code reviews.
Index ¶
- Constants
- type Client
- func (c *Client) Approve(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
- func (c *Client) Comment(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
- func (c *Client) CreateComment(ctx context.Context, input *CommentInput) (*CommentResult, error)
- func (c *Client) CreateLineComment(ctx context.Context, input *LineCommentInput) (*CommentResult, error)
- func (c *Client) CreateReview(ctx context.Context, input *ReviewInput) (*ReviewResult, error)
- func (c *Client) GetPR(ctx context.Context, owner, repo string, number int) (*PRInfo, error)
- func (c *Client) GetPRDiff(ctx context.Context, owner, repo string, number int) (string, error)
- func (c *Client) ListOpenPRs(ctx context.Context, owner, repo string) ([]PRSummary, error)
- func (c *Client) RequestChanges(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
- type CommentInput
- type CommentResult
- type LineCommentInput
- type PRInfo
- type PRSummary
- type ReviewEvent
- type ReviewInput
- type ReviewResult
Constants ¶
ReviewFooter is appended to all reviews for transparency.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides code review operations.
func NewClientFromAppConfig ¶
NewClientFromAppConfig creates a new review client using GitHub App authentication.
func NewClientFromToken ¶
NewClientFromToken creates a new review client using a personal access token.
func (*Client) Approve ¶
func (c *Client) Approve(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
Approve approves a pull request with an optional comment.
func (*Client) Comment ¶
func (c *Client) Comment(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
Comment adds a review comment without approval or rejection.
func (*Client) CreateComment ¶
func (c *Client) CreateComment(ctx context.Context, input *CommentInput) (*CommentResult, error)
CreateComment adds a general comment to a pull request. The review footer is automatically appended to the body.
func (*Client) CreateLineComment ¶
func (c *Client) CreateLineComment(ctx context.Context, input *LineCommentInput) (*CommentResult, error)
CreateLineComment adds a comment on a specific line in a PR diff.
func (*Client) CreateReview ¶
func (c *Client) CreateReview(ctx context.Context, input *ReviewInput) (*ReviewResult, error)
CreateReview posts a code review to a pull request. The review footer is automatically appended to the body.
func (*Client) ListOpenPRs ¶
ListOpenPRs lists open pull requests in a repository.
func (*Client) RequestChanges ¶
func (c *Client) RequestChanges(ctx context.Context, owner, repo string, number int, body string) (*ReviewResult, error)
RequestChanges requests changes on a pull request.
type CommentInput ¶
CommentInput contains parameters for creating a PR comment.
type CommentResult ¶
CommentResult contains the result of a comment operation.
type LineCommentInput ¶
type LineCommentInput struct {
Owner string
Repo string
PRNumber int
CommitID string
Path string
Line int
Body string
}
LineCommentInput contains parameters for creating a line comment.
type PRInfo ¶
type PRInfo struct {
Number int
Title string
Body string
State string
Author string
Head string
Base string
Commits int
HTMLURL string
}
PRInfo contains pull request information.
type ReviewEvent ¶
type ReviewEvent string
ReviewEvent represents the type of review action.
const ( // EventApprove approves the pull request. EventApprove ReviewEvent = "APPROVE" // EventRequestChanges requests changes to the pull request. EventRequestChanges ReviewEvent = "REQUEST_CHANGES" // EventComment adds a review comment without approval or rejection. EventComment ReviewEvent = "COMMENT" )
type ReviewInput ¶
type ReviewInput struct {
Owner string
Repo string
PRNumber int
Event ReviewEvent
Body string
}
ReviewInput contains parameters for creating a review.
type ReviewResult ¶
ReviewResult contains the result of a review operation.