github

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(ctx context.Context) (*clientImpl, error)

NewClient creates a new GitHub API client. It resolves authentication by first trying `gh auth token` (GitHub CLI), then falling back to the GITHUB_TOKEN environment variable.

Types

type ActionReader

type ActionReader interface {
	ListWorkflows(ctx context.Context, owner, repo string, opts *gh.ListOptions) ([]*gh.Workflow, error)
	ListWorkflowRuns(ctx context.Context, owner, repo string, opts *gh.ListWorkflowRunsOptions) ([]*gh.WorkflowRun, error)
	GetWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*gh.WorkflowRun, error)
	ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64) ([]*gh.WorkflowJob, error)
	GetJobLogs(ctx context.Context, owner, repo string, jobID int64) (string, error)
	GetWorkflowInputs(ctx context.Context, owner, repo, path, ref string) ([]WorkflowInput, error)
}

ActionReader provides read-only access to GitHub Actions workflow runs and jobs.

type ActionStatus

type ActionStatus string

ActionStatus represents the conclusion or status of a GitHub Actions workflow run.

const (
	ActionStatusSuccess    ActionStatus = "success"
	ActionStatusFailure    ActionStatus = "failure"
	ActionStatusInProgress ActionStatus = "in_progress"
	ActionStatusQueued     ActionStatus = "queued"
	ActionStatusCancelled  ActionStatus = "cancelled"
)

type ActionWriter

type ActionWriter interface {
	RerunFailedJobs(ctx context.Context, owner, repo string, runID int64) error
	RerunWorkflow(ctx context.Context, owner, repo string, runID int64) error
	CancelWorkflowRun(ctx context.Context, owner, repo string, runID int64) error
	DispatchWorkflow(ctx context.Context, owner, repo string, workflowID int64, ref string, inputs map[string]any) error
}

ActionWriter provides mutation operations on GitHub Actions workflow runs.

type Client

Client composes all GitHub operation interfaces into a single client.

type IssueFilter

type IssueFilter string

IssueFilter defines filter options for listing issues.

const (
	IssueFilterAll       IssueFilter = "all"
	IssueFilterAssigned  IssueFilter = "assigned"
	IssueFilterMentioned IssueFilter = "mentioned"
	IssueFilterCreated   IssueFilter = "created"
)

type IssueReader

type IssueReader interface {
	ListIssues(ctx context.Context, owner, repo string, opts *gh.IssueListByRepoOptions) ([]*gh.Issue, error)
	GetIssue(ctx context.Context, owner, repo string, number int) (*gh.Issue, error)
	GetIssueComments(ctx context.Context, owner, repo string, number int) ([]*gh.IssueComment, error)
}

IssueReader provides read-only access to GitHub issues.

type IssueWriter

type IssueWriter interface {
	CreateIssue(ctx context.Context, owner, repo string, req *gh.IssueRequest) (*gh.Issue, error)
	EditIssue(ctx context.Context, owner, repo string, number int, req *gh.IssueRequest) error
	CommentOnIssue(ctx context.Context, owner, repo string, number int, body string) error
	CloseIssue(ctx context.Context, owner, repo string, number int) error
	ReopenIssue(ctx context.Context, owner, repo string, number int) error
}

IssueWriter provides mutation operations on GitHub issues.

type NotificationReader

type NotificationReader interface {
	ListNotifications(ctx context.Context, opts *gh.NotificationListOptions) ([]*gh.Notification, error)
	MarkRead(ctx context.Context, threadID string) error
}

NotificationReader provides access to GitHub notifications.

type PRFilter

type PRFilter string

PRFilter defines filter options for listing pull requests.

const (
	PRFilterAll         PRFilter = "all"
	PRFilterNeedsReview PRFilter = "needs_review"
	PRFilterMine        PRFilter = "mine"
	PRFilterDraft       PRFilter = "draft"
)

type PRReader

type PRReader interface {
	ListPRs(ctx context.Context, owner, repo string, opts *gh.PullRequestListOptions) ([]*gh.PullRequest, error)
	GetPR(ctx context.Context, owner, repo string, number int) (*gh.PullRequest, error)
	GetPRFiles(ctx context.Context, owner, repo string, number int) ([]*gh.CommitFile, error)
	GetPRComments(ctx context.Context, owner, repo string, number int) ([]*gh.PullRequestComment, error)
	GetPRReviews(ctx context.Context, owner, repo string, number int) ([]*gh.PullRequestReview, error)
	GetPRDiff(ctx context.Context, owner, repo string, number int) (string, error)
	GetPRCommits(ctx context.Context, owner, repo string, number int) ([]*gh.RepositoryCommit, error)
}

PRReader provides read-only access to GitHub pull requests.

type PRWriter

type PRWriter interface {
	CreatePR(ctx context.Context, owner, repo string, req *gh.NewPullRequest) (*gh.PullRequest, error)
	MergePR(ctx context.Context, owner, repo string, number int, msg string, opts *gh.PullRequestOptions) error
	DeleteBranch(ctx context.Context, owner, repo, branch string) error
	CommentOnPR(ctx context.Context, owner, repo string, number int, body string, path string, line int) error
	SubmitReview(ctx context.Context, owner, repo string, number int, review *gh.PullRequestReviewRequest) error
	RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers []string) error
}

PRWriter provides mutation operations on GitHub pull requests.

type ReleaseReader

type ReleaseReader interface {
	ListReleases(ctx context.Context, owner, repo string, opts *gh.ListOptions) ([]*gh.RepositoryRelease, error)
	GetRelease(ctx context.Context, owner, repo string, id int64) (*gh.RepositoryRelease, error)
	GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*gh.RepositoryRelease, error)
}

ReleaseReader provides read-only access to GitHub releases.

type WorkflowInput

type WorkflowInput struct {
	Name        string
	Description string
	Default     string
	Type        string   // "string", "choice", "boolean", "environment"
	Options     []string // for "choice" type
	Required    bool
}

WorkflowInput describes a single input parameter defined in a workflow_dispatch trigger.

Jump to

Keyboard shortcuts

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