Documentation
¶
Index ¶
- func BuildReviewBody(summary string, comments []ReviewComment) ([]byte, error)
- func FetchChecks(ctx context.Context, url string) (string, error)
- func FetchDiff(ctx context.Context, url string) (string, error)
- func PostPendingReview(ctx context.Context, prURL, summary string, comments []ReviewComment) (int64, error)
- func PostQuickReview(ctx context.Context, prURL, event, body string) (int64, error)
- type CLIClient
- type Check
- type ChecksSummary
- type Comment
- type InlineComment
- type Label
- type PR
- type PRDetail
- type Query
- type Review
- type ReviewComment
- type Reviewer
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildReviewBody ¶
func BuildReviewBody(summary string, comments []ReviewComment) ([]byte, error)
func FetchChecks ¶
FetchChecks returns the formatted output of `gh pr checks <url>`, listing every CI check on the PR with status + link. `gh pr checks` exits non-zero when any check failed, but the listing is still on stdout — so we keep stdout regardless of exit code.
func PostPendingReview ¶
Types ¶
type ChecksSummary ¶
type ChecksSummary struct {
Passed int
Failed int
Pending int
FailedNames []string
PendingNames []string
}
func SummarizeChecks ¶
func SummarizeChecks(checks []Check) ChecksSummary
type Comment ¶
type InlineComment ¶
type InlineComment struct {
ID int64 `json:"id"`
Path string `json:"path"`
Line int `json:"line"`
Body string `json:"body"`
CreatedAt string `json:"created_at"`
User struct {
Login string `json:"login"`
} `json:"user"`
}
InlineComment is a per-line review comment fetched via `gh api`.
type PR ¶
type PR struct {
Number int `json:"number"`
Title string `json:"title"`
URL string `json:"url"`
Author string
HeadRefName string `json:"headRefName"`
BaseRefName string `json:"baseRefName"`
UpdatedAt string `json:"updatedAt"`
CreatedAt string `json:"createdAt"`
Repo string // populated from RepositoryRaw.NameWithOwner
AuthorRaw struct {
Login string `json:"login"`
} `json:"author"`
RepositoryRaw struct {
NameWithOwner string `json:"nameWithOwner"`
} `json:"repository"`
}
type PRDetail ¶
type PRDetail struct {
PR
Body string `json:"body"`
Checks []Check `json:"statusCheckRollup"`
Comments []Comment `json:"comments"`
Reviews []Review `json:"reviews"`
State string `json:"state"` // OPEN, CLOSED, MERGED
IsDraft bool `json:"isDraft"`
ReviewDecision string `json:"reviewDecision"` // APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED, ""
MergeStateStatus string `json:"mergeStateStatus"`
Mergeable string `json:"mergeable"` // MERGEABLE, CONFLICTING, UNKNOWN
Labels []Label `json:"labels"`
Assignees []User `json:"assignees"`
ReviewRequests []User `json:"reviewRequests"`
UpdatedAt string `json:"updatedAt"`
ChangedFiles int `json:"changedFiles"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Inline []InlineComment `json:"-"`
}
type Review ¶
type ReviewComment ¶
Click to show internal directories.
Click to hide internal directories.