Documentation
¶
Index ¶
- func CacheDir() string
- func ReadBranchCache(cacheDir, org, repo string) map[string]string
- func ReadUserCache(cacheDir string) string
- func WriteBranchCache(cacheDir, org, repo string, branches map[string]string)
- func WritePRCache(cacheDir, org, repo string, prs []PR)
- func WriteUserCache(cacheDir, login string)
- type CheckRun
- type Client
- type LiveClient
- func (LiveClient) MergedPRsForRepo(org, repo string) ([]PR, error)
- func (LiveClient) PRDetail(org, repo string, number int) (PRDetailResult, error)
- func (LiveClient) PRFromNumber(org, repo string, number int) (*PR, error)
- func (LiveClient) PRsForRepo(org, repo string) ([]PR, error)
- func (LiveClient) WorkflowRuns(org, repo, branch string, limit int) ([]WorkflowRun, error)
- type PR
- type PRDetailResult
- type WorkflowRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadBranchCache ¶
ReadBranchCache reads cached worktree-to-branch mappings. Returns nil on miss or corruption.
func ReadUserCache ¶
ReadUserCache reads the cached GitHub username. Returns "" on miss.
func WriteBranchCache ¶
WriteBranchCache writes worktree-to-branch mappings to a cache file.
func WritePRCache ¶
WritePRCache writes PR data to a cache file atomically. Errors are silently swallowed (best-effort).
func WriteUserCache ¶
func WriteUserCache(cacheDir, login string)
WriteUserCache writes the GitHub username to a cache file.
Types ¶
type CheckRun ¶
type CheckRun struct {
Name string `json:"name"`
Conclusion string `json:"conclusion"`
Status string `json:"status"`
}
CheckRun represents a single CI check.
type Client ¶
type Client interface {
PRsForRepo(org, repo string) ([]PR, error)
MergedPRsForRepo(org, repo string) ([]PR, error)
PRFromNumber(org, repo string, number int) (*PR, error)
PRDetail(org, repo string, number int) (PRDetailResult, error)
WorkflowRuns(org, repo, branch string, limit int) ([]WorkflowRun, error)
}
Client abstracts GitHub API access for testability.
type LiveClient ¶
type LiveClient struct{}
LiveClient calls the real gh CLI.
func (LiveClient) MergedPRsForRepo ¶
func (LiveClient) MergedPRsForRepo(org, repo string) ([]PR, error)
func (LiveClient) PRDetail ¶
func (LiveClient) PRDetail(org, repo string, number int) (PRDetailResult, error)
func (LiveClient) PRFromNumber ¶
func (LiveClient) PRFromNumber(org, repo string, number int) (*PR, error)
func (LiveClient) PRsForRepo ¶
func (LiveClient) PRsForRepo(org, repo string) ([]PR, error)
func (LiveClient) WorkflowRuns ¶
func (LiveClient) WorkflowRuns(org, repo, branch string, limit int) ([]WorkflowRun, error)
type PR ¶
type PR struct {
Number int `json:"number"`
Title string `json:"title"`
HeadRefName string `json:"headRefName"`
State string `json:"state"`
ReviewDecision string `json:"reviewDecision"`
StatusRollup string `json:"statusRollup"` // derived from statusCheckRollup
URL string `json:"url"`
Author string `json:"authorLogin"` // GitHub login; extracted from nested author.login via extractAuthor(); tag avoids collision with gh's "author" object
MergedAt string `json:"mergedAt"`
}
PR represents a pull request associated with a branch.
func MergedPRsForRepo ¶
MergedPRsForRepo returns recently merged PRs for a given org/repo.
func PRFromNumber ¶
PRFromNumber fetches a specific PR by number.
func PRsForRepo ¶
PRsForRepo returns open PRs for a given org/repo.
func ReadPRCache ¶
ReadPRCache reads cached PR data for a repo. Returns nil, nil on miss or corruption.
type PRDetailResult ¶
PRDetailResult holds all data returned by PRDetail.
type WorkflowRun ¶
type WorkflowRun struct {
Name string `json:"name"`
Status string `json:"status"` // completed, in_progress, queued
Conclusion string `json:"conclusion"` // success, failure, cancelled, etc.
CreatedAt string `json:"createdAt"`
}
WorkflowRun represents a GitHub Actions workflow run.
func WorkflowRuns ¶
func WorkflowRuns(org, repo, branch string, limit int) ([]WorkflowRun, error)
WorkflowRuns returns recent workflow runs for a repo/branch.