Documentation
¶
Index ¶
- func GetCurrentUser(ctx context.Context) (string, error)
- func RepoFullName(cfg *config.Config, short string) string
- func RepoShortName(cfg *config.Config, full string) string
- type ApprovedPR
- type AuthorInfo
- type Client
- func (c *Client) GetPRAuthor(ctx context.Context, fullRepo string, prNumber int) (string, error)
- func (c *Client) GetPRDetails(ctx context.Context, fullRepo string, prNumber int) (*PRDetails, error)
- func (c *Client) GetPRFiles(ctx context.Context, fullRepo string, prNumber int) ([]string, error)
- func (c *Client) GetPRState(ctx context.Context, fullRepo string, prNumber int) (string, error)
- func (c *Client) GetPRStateByBranch(ctx context.Context, fullRepo, branch string) (string, int, error)
- func (c *Client) GetPRTitle(ctx context.Context, fullRepo string, prNumber int) (string, error)
- func (c *Client) GetReviewStatus(ctx context.Context, fullRepo string, prNumber int) (string, error)
- func (c *Client) GitHub() *gh.Client
- type PRDetails
- type RepoInfo
- type ReviewRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentUser ¶
GetCurrentUser returns the authenticated GitHub user's login.
func RepoFullName ¶
RepoFullName maps short repo name to full GitHub path using config.
Types ¶
type ApprovedPR ¶
type ApprovedPR struct {
Number int `json:"number"`
Title string `json:"title"`
Author AuthorInfo `json:"author"`
Repository RepoInfo `json:"repository"`
CreatedAt string `json:"createdAt"`
URL string `json:"url"`
ReviewDecision string `json:"reviewDecision"`
}
ApprovedPR represents a user's approved but unmerged PR.
func GetApprovedUnmerged ¶
func GetApprovedUnmerged(ctx context.Context, repoFilter string) ([]ApprovedPR, error)
GetApprovedUnmerged fetches the user's own PRs that are approved but not yet merged.
type AuthorInfo ¶
type AuthorInfo struct {
Login string `json:"login"`
}
AuthorInfo holds author login info.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps go-github with auth from `gh auth token`.
func (*Client) GetPRAuthor ¶
GetPRAuthor returns the login of the PR author.
func (*Client) GetPRDetails ¶
func (c *Client) GetPRDetails(ctx context.Context, fullRepo string, prNumber int) (*PRDetails, error)
GetPRDetails fetches details for a specific PR.
func (*Client) GetPRFiles ¶
GetPRFiles returns the list of changed file paths for a PR.
func (*Client) GetPRState ¶
GetPRState returns the state of a PR: OPEN, CLOSED, or MERGED.
func (*Client) GetPRStateByBranch ¶
func (c *Client) GetPRStateByBranch(ctx context.Context, fullRepo, branch string) (string, int, error)
GetPRStateByBranch looks up PRs by head branch name and returns the state ("MERGED", "CLOSED", "OPEN") and PR number of the first match. Returns ("", 0, nil) if no PR found for that branch.
func (*Client) GetPRTitle ¶
GetPRTitle returns the title of a PR.
type PRDetails ¶
type PRDetails struct {
Number int `json:"number"`
Title string `json:"title"`
Author string `json:"author"`
State string `json:"state"`
HeadRefName string `json:"head_ref_name"`
BaseRefName string `json:"base_ref_name"`
Body string `json:"body"`
CreatedAt string `json:"created_at"`
URL string `json:"url"`
IsFork bool `json:"is_fork"`
}
PRDetails holds basic PR information.
type ReviewRequest ¶
type ReviewRequest struct {
Number int `json:"number"`
Title string `json:"title"`
Author AuthorInfo `json:"author"`
Repository RepoInfo `json:"repository"`
CreatedAt string `json:"createdAt"`
URL string `json:"url"`
}
ReviewRequest represents a PR review request.
func GetReviewRequests ¶
func GetReviewRequests(ctx context.Context, repoFilter string) ([]ReviewRequest, error)
GetReviewRequests fetches PRs where the user is a requested reviewer, including re-reviews. Uses GraphQL via `gh api graphql`.
func ListOpenPRs ¶
ListOpenPRs lists open PRs for a repository using `gh pr list`.