github

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GhCli

type GhCli struct {
	// contains filtered or unexported fields
}

func New

func New() *GhCli

func (*GhCli) CreatePR

func (c *GhCli) CreatePR(ctx context.Context, p NewPR) (PullRequest, error)

func (*GhCli) CurrentUser

func (c *GhCli) CurrentUser(_ context.Context) (string, error)

func (*GhCli) GetPR

func (c *GhCli) GetPR(_ context.Context, number int) (PullRequest, error)

func (*GhCli) ListAllOpenPRs added in v0.1.4

func (c *GhCli) ListAllOpenPRs(_ context.Context) ([]PullRequest, error)

func (*GhCli) ListMergedPRsByHead

func (c *GhCli) ListMergedPRsByHead(_ context.Context, heads []string) ([]PullRequest, error)

func (*GhCli) ListOpenPRs

func (c *GhCli) ListOpenPRs(_ context.Context) ([]PullRequest, error)

func (*GhCli) ListReviewRequestedPRs added in v0.1.5

func (c *GhCli) ListReviewRequestedPRs(_ context.Context) ([]PullRequest, error)

func (*GhCli) UpdatePRBase

func (c *GhCli) UpdatePRBase(_ context.Context, number int, newBase string) error

func (*GhCli) UpdatePRBody

func (c *GhCli) UpdatePRBody(_ context.Context, number int, body string) error

func (*GhCli) UpdatePRTitle added in v0.1.5

func (c *GhCli) UpdatePRTitle(_ context.Context, number int, newTitle string) error

type GitHubClient

type GitHubClient interface {
	CurrentUser(ctx context.Context) (string, error)
	ListOpenPRs(ctx context.Context) ([]PullRequest, error)
	// ListAllOpenPRs returns all open PRs in the repo regardless of author.
	// Used by cn status --all to build the full PR dependency graph.
	ListAllOpenPRs(ctx context.Context) ([]PullRequest, error)
	// ListReviewRequestedPRs returns open PRs where the current user is a
	// requested reviewer. Used by the Review tab.
	ListReviewRequestedPRs(ctx context.Context) ([]PullRequest, error)
	// ListMergedPRsByHead returns at most one merged PR per head (the most recent
	// by number when there are duplicates). Heads that have no merged PR are
	// simply absent from the result. Used by sync's squash-merged-parent detection.
	ListMergedPRsByHead(ctx context.Context, heads []string) ([]PullRequest, error)
	GetPR(ctx context.Context, number int) (PullRequest, error)
	CreatePR(ctx context.Context, p NewPR) (PullRequest, error)
	UpdatePRBody(ctx context.Context, number int, body string) error
	UpdatePRBase(ctx context.Context, number int, newBase string) error
	UpdatePRTitle(ctx context.Context, number int, newTitle string) error
}

type MockGhClient

type MockGhClient struct {
	User    string
	PRs     map[int]PullRequest
	NextNum int
	Calls   []string
	// contains filtered or unexported fields
}

func NewMock

func NewMock() *MockGhClient

func (*MockGhClient) CreatePR

func (m *MockGhClient) CreatePR(_ context.Context, p NewPR) (PullRequest, error)

func (*MockGhClient) CurrentUser

func (m *MockGhClient) CurrentUser(_ context.Context) (string, error)

func (*MockGhClient) GetPR

func (m *MockGhClient) GetPR(_ context.Context, number int) (PullRequest, error)

func (*MockGhClient) ListAllOpenPRs added in v0.1.4

func (m *MockGhClient) ListAllOpenPRs(_ context.Context) ([]PullRequest, error)

func (*MockGhClient) ListMergedPRsByHead

func (m *MockGhClient) ListMergedPRsByHead(_ context.Context, heads []string) ([]PullRequest, error)

func (*MockGhClient) ListOpenPRs

func (m *MockGhClient) ListOpenPRs(_ context.Context) ([]PullRequest, error)

func (*MockGhClient) ListReviewRequestedPRs added in v0.1.5

func (m *MockGhClient) ListReviewRequestedPRs(_ context.Context) ([]PullRequest, error)

func (*MockGhClient) SetReviewRequested added in v0.1.5

func (m *MockGhClient) SetReviewRequested(numbers ...int)

ReviewRequested holds PR numbers where the mock user is a requested reviewer.

func (*MockGhClient) SetState

func (m *MockGhClient) SetState(number int, state string)

func (*MockGhClient) UpdatePRBase

func (m *MockGhClient) UpdatePRBase(_ context.Context, number int, newBase string) error

func (*MockGhClient) UpdatePRBody

func (m *MockGhClient) UpdatePRBody(_ context.Context, number int, body string) error

func (*MockGhClient) UpdatePRTitle added in v0.1.5

func (m *MockGhClient) UpdatePRTitle(_ context.Context, number int, newTitle string) error

type NewPR

type NewPR struct {
	Title string
	Body  string
	Head  string
	Base  string
	Draft bool
}

type PullRequest

type PullRequest struct {
	Number         int
	Title          string
	BaseRefName    string
	HeadRefName    string
	State          string
	Body           string
	MergeCommitSHA string
	// CIStatus is the aggregate status check rollup: SUCCESS, FAILURE,
	// PENDING, or "" (no checks configured).
	CIStatus string
	// ReviewDecision is APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED, or "".
	ReviewDecision string
	// UpdatedAt is the RFC3339 string from gh's updatedAt field.
	UpdatedAt string
}

Jump to

Keyboard shortcuts

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