github

package
v0.1.1 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) ListMergedPRsByHead

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

func (*GhCli) ListOpenPRs

func (c *GhCli) ListOpenPRs(_ 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

type GitHubClient

type GitHubClient interface {
	CurrentUser(ctx context.Context) (string, error)
	ListOpenPRs(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
}

type MockGhClient

type MockGhClient struct {
	User    string
	PRs     map[int]PullRequest
	NextNum int
	Calls   []string
}

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) ListMergedPRsByHead

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

func (*MockGhClient) ListOpenPRs

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

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

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
}

Jump to

Keyboard shortcuts

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