platform

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckService

type CheckService interface {
	// GetCombinedStatus returns the combined CI status for a ref (branch or SHA).
	// Returns "success", "failure", "pending", or "error".
	GetCombinedStatus(ctx context.Context, ref string) (string, error)

	// RerunFailedChecks re-runs failed check suites for a ref.
	RerunFailedChecks(ctx context.Context, ref string) error
}

type Comment

type Comment struct {
	ID                int64
	Body              string
	AuthorLogin       string
	AuthorAssociation string // "OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR", "NONE", etc.
}

type Issue

type Issue struct {
	Number    int
	Title     string
	Body      string
	State     string // "open", "closed"
	Labels    []string
	Milestone *Milestone
	Assignees []string
	URL       string
}

type IssueFilters

type IssueFilters struct {
	State     string // "open", "closed", "all"
	Labels    []string
	Milestone *int
}

type IssueService

type IssueService interface {
	Create(ctx context.Context, title, body string, labels []string, milestone *int) (*Issue, error)
	Get(ctx context.Context, number int) (*Issue, error)
	List(ctx context.Context, filters IssueFilters) ([]*Issue, error)
	Update(ctx context.Context, number int, changes IssueUpdate) (*Issue, error)
	AddLabels(ctx context.Context, number int, labels []string) error
	RemoveLabels(ctx context.Context, number int, labels []string) error
	AddComment(ctx context.Context, number int, body string) error
	DeleteComment(ctx context.Context, commentID int64) error
	ListComments(ctx context.Context, number int) ([]*Comment, error)
	CreateCommentReaction(ctx context.Context, commentID int64, reaction string) error
}

type IssueUpdate

type IssueUpdate struct {
	Title     *string
	Body      *string
	State     *string // "open", "closed"
	Milestone *int    // 0 to clear
}

type Label

type Label struct {
	Name        string
	Color       string
	Description string
}

type LabelService

type LabelService interface {
	Create(ctx context.Context, name, color, description string) error
	List(ctx context.Context) ([]*Label, error)
	Delete(ctx context.Context, name string) error
}

type MergeMethod

type MergeMethod string
const (
	MergeMethodMerge  MergeMethod = "merge"
	MergeMethodSquash MergeMethod = "squash"
	MergeMethodRebase MergeMethod = "rebase"
)

type MergeResult

type MergeResult struct {
	SHA     string
	Merged  bool
	Message string
}

type Milestone

type Milestone struct {
	Number       int
	Title        string
	Description  string
	State        string // "open", "closed"
	DueDate      *time.Time
	OpenIssues   int
	ClosedIssues int
}

type MilestoneService

type MilestoneService interface {
	Create(ctx context.Context, title, description string, dueDate *time.Time) (*Milestone, error)
	Get(ctx context.Context, number int) (*Milestone, error)
	List(ctx context.Context) ([]*Milestone, error)
	Update(ctx context.Context, number int, changes MilestoneUpdate) (*Milestone, error)
}

type MilestoneUpdate

type MilestoneUpdate struct {
	Title       *string
	Description *string
	State       *string // "open", "closed"
	DueDate     *time.Time
}

type PRFilters

type PRFilters struct {
	State string // "open", "closed", "all"
	Head  string
	Base  string
}

type Platform

type Platform interface {
	Issues() IssueService
	PullRequests() PullRequestService
	Workflows() WorkflowService
	Labels() LabelService
	Milestones() MilestoneService
	Runners() RunnerService
	Repository() RepositoryService
	Checks() CheckService
}

Platform abstracts all interactions with the hosting platform (GitHub, GitLab, etc.).

type PullRequest

type PullRequest struct {
	Number    int
	Title     string
	Body      string
	State     string // "open", "closed", "merged"
	Head      string // branch name
	Base      string // target branch
	Mergeable bool
	URL       string
	CreatedAt time.Time
}

type PullRequestService

type PullRequestService interface {
	Create(ctx context.Context, title, body, head, base string) (*PullRequest, error)
	Get(ctx context.Context, number int) (*PullRequest, error)
	List(ctx context.Context, filters PRFilters) ([]*PullRequest, error)
	Update(ctx context.Context, number int, title, body *string) (*PullRequest, error)
	Merge(ctx context.Context, number int, method MergeMethod) (*MergeResult, error)
	UpdateBranch(ctx context.Context, number int) error
	CreateReview(ctx context.Context, number int, body string, event ReviewEvent) error
	AddComment(ctx context.Context, number int, body string) error
	GetDiff(ctx context.Context, number int) (string, error)
}

type RepoInfo

type RepoInfo struct {
	Owner         string
	Name          string
	DefaultBranch string
	Private       bool
	URL           string
}

type RepositoryService

type RepositoryService interface {
	GetInfo(ctx context.Context) (*RepoInfo, error)
	GetDefaultBranch(ctx context.Context) (string, error)
	CreateBranch(ctx context.Context, name, fromSHA string) error
	DeleteBranch(ctx context.Context, name string) error
	GetBranchSHA(ctx context.Context, name string) (string, error)
}

type ReviewEvent

type ReviewEvent string
const (
	ReviewApprove        ReviewEvent = "APPROVE"
	ReviewRequestChanges ReviewEvent = "REQUEST_CHANGES"
	ReviewComment        ReviewEvent = "COMMENT"
)

type Run

type Run struct {
	ID         int64
	Status     string            // "queued", "in_progress", "completed"
	Conclusion string            // "success", "failure", "cancelled"
	Inputs     map[string]string // workflow_dispatch inputs
	URL        string
	CreatedAt  time.Time
}

type RunFilters

type RunFilters struct {
	WorkflowID int64
	Status     string // "queued", "in_progress", "completed"
	Branch     string
}

type Runner

type Runner struct {
	ID     int64
	Name   string
	Status string // "online", "offline"
	Labels []string
	Busy   bool
}

type RunnerService

type RunnerService interface {
	List(ctx context.Context) ([]*Runner, error)
	Get(ctx context.Context, id int64) (*Runner, error)
}

type WorkflowService

type WorkflowService interface {
	GetWorkflow(ctx context.Context, filename string) (workflowID int64, err error)
	Dispatch(ctx context.Context, workflowFile, ref string, inputs map[string]string) (*Run, error)
	GetRun(ctx context.Context, runID int64) (*Run, error)
	ListRuns(ctx context.Context, filters RunFilters) ([]*Run, error)
	CancelRun(ctx context.Context, runID int64) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL