Documentation
¶
Index ¶
- func BuildBaseURL(host string, providerType ProviderType) string
- func ExtractHostFromURL(remoteURL string) string
- func ParseRemoteURL(remoteURL string) (owner, repo string, err error)
- type Artifact
- type ArtifactStats
- type CheckRun
- type CommitInfo
- type Job
- type LinkedIssue
- type PRChecks
- type PRChecksUpdate
- type Provider
- type ProviderType
- type PullRequestDetails
- type ReviewerStatus
- type StatusCheck
- type Workflow
- type WorkflowUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBaseURL ¶ added in v1.2.1
func BuildBaseURL(host string, providerType ProviderType) string
BuildBaseURL constructs the API base URL for a provider For GitHub: https://api.github.com (or custom for enterprise) For GitLab: https://gitlab.com/api/v4 (or custom for self-hosted)
func ExtractHostFromURL ¶ added in v1.2.1
ExtractHostFromURL extracts the hostname from a git remote URL Returns the host for self-hosted instances
func ParseRemoteURL ¶ added in v1.2.1
ParseRemoteURL extracts owner and repo from a git remote URL
Types ¶
type Artifact ¶ added in v1.2.1
type Artifact struct {
ID int64
Name string
SizeInBytes int64
CreatedAt time.Time
ExpiresAt time.Time
Expired bool
WorkflowRun string // Workflow run that created this artifact
WorkflowName string // Name of the workflow
}
Artifact represents a workflow artifact
type ArtifactStats ¶ added in v1.2.1
ArtifactStats represents artifact storage statistics
type CheckRun ¶
type CheckRun struct {
ID int64
Name string
Status string // queued, in_progress, completed
Conclusion string // success, failure, cancelled, skipped
URL string
StartedAt time.Time
CompletedAt time.Time
FailedStep string // Name of the failed step (if any)
ErrorLog string // Last lines of error log (if failed)
}
CheckRun represents a GitHub Actions check run
type CommitInfo ¶ added in v1.3.0
CommitInfo represents a commit in a PR
type Job ¶
type Job struct {
Name string
Status string // queued, in_progress, completed
Conclusion string // success, failure, cancelled, skipped
}
Job represents a job within a workflow
type LinkedIssue ¶ added in v1.3.0
type LinkedIssue struct {
Number int
Title string
Body string
State string // open, closed
URL string
Labels []string
Assignees []string
CreatedAt time.Time
UpdatedAt time.Time
Author string
}
LinkedIssue represents an issue linked to a PR
type PRChecks ¶
type PRChecks struct {
TotalCount int
Pending int
Success int
Failure int
Queued int
InProgress int
Status string // pending, success, failure
HeadSHA string // The commit SHA these checks are for
UpdatedAt time.Time
Checks []CheckRun
StatusChecks []StatusCheck
}
PRChecks represents the status of all checks for a PR
type PRChecksUpdate ¶
PRChecksUpdate represents a PR checks status update
type Provider ¶
type Provider interface {
// GetLatestWorkflow returns the most recent workflow run for a branch
GetLatestWorkflow(ctx context.Context, branch string) (*Workflow, error)
// WatchWorkflow streams updates for a running workflow
WatchWorkflow(ctx context.Context, workflowID string) (<-chan WorkflowUpdate, error)
// CreatePullRequest creates a new pull request
CreatePullRequest(ctx context.Context, title, body, head, base string, draft bool) (number int, url string, err error)
// MarkPullRequestReady marks a draft PR as ready for review
MarkPullRequestReady(ctx context.Context, prNumber int) error
// GetPullRequestByBranch finds a PR for the given head branch
GetPullRequestByBranch(ctx context.Context, branch string) (number int, url string, err error)
// MergePullRequest merges a pull request
MergePullRequest(ctx context.Context, prNumber int, method string) error
// GetPullRequestChecks returns the status of all checks/workflows for a PR
GetPullRequestChecks(ctx context.Context, prNumber int) (*PRChecks, error)
// WaitForChecksToStart waits for CI checks to start for a PR
// Returns the HEAD SHA being checked and the initial checks status
// This ensures we don't check stale results from previous commits
WaitForChecksToStart(ctx context.Context, prNumber int, timeout time.Duration) (headSHA string, checks *PRChecks, err error)
// WatchPullRequestChecks streams updates for PR checks until all complete
WatchPullRequestChecks(ctx context.Context, prNumber int) (<-chan PRChecksUpdate, error)
}
Provider is the interface for CI/CD providers (GitHub, GitLab, etc.)
type ProviderType ¶ added in v1.2.1
type ProviderType string
ProviderType represents the type of git remote provider
const ( ProviderTypeGitHub ProviderType = "github" ProviderTypeGitLab ProviderType = "gitlab" ProviderTypeUnknown ProviderType = "unknown" )
func DetectProviderFromURL ¶ added in v1.2.1
func DetectProviderFromURL(remoteURL string) ProviderType
DetectProviderFromURL detects the provider type from a git remote URL Supports both SSH (git@host:owner/repo.git) and HTTPS (https://host/owner/repo.git) formats
type PullRequestDetails ¶ added in v1.3.0
type PullRequestDetails struct {
Number int
Title string
Body string
State string // open, closed, merged
Draft bool
HeadBranch string
BaseBranch string
HeadSHA string
Author string
CreatedAt time.Time
UpdatedAt time.Time
Additions int
Deletions int
ChangedFiles int
Mergeable bool
MergeMethod string // merge, squash, rebase
URL string
Labels []string
Reviewers []ReviewerStatus
LinkedIssues []LinkedIssue
Commits []CommitInfo
}
PullRequestDetails contains full details about a pull request for TUI display
type ReviewerStatus ¶ added in v1.3.0
type ReviewerStatus struct {
Login string
State string // PENDING, APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED
Avatar string
}
ReviewerStatus represents a reviewer and their review status
type StatusCheck ¶
type StatusCheck struct {
Context string
State string // pending, success, failure, error
URL string
}
StatusCheck represents a commit status check
type Workflow ¶
type Workflow struct {
ID string
Status string // queued, in_progress, completed
Conclusion string // success, failure, cancelled, skipped
Jobs []Job
URL string
}
Workflow represents a CI/CD workflow run
type WorkflowUpdate ¶
WorkflowUpdate represents a workflow status update