Documentation
¶
Index ¶
- type GhCli
- func (c *GhCli) CreatePR(ctx context.Context, p NewPR) (PullRequest, error)
- func (c *GhCli) CurrentUser(_ context.Context) (string, error)
- func (c *GhCli) GetPR(_ context.Context, number int) (PullRequest, error)
- func (c *GhCli) ListAllOpenPRs(_ context.Context) ([]PullRequest, error)
- func (c *GhCli) ListMergedPRsByHead(_ context.Context, heads []string) ([]PullRequest, error)
- func (c *GhCli) ListOpenPRs(_ context.Context) ([]PullRequest, error)
- func (c *GhCli) ListReviewRequestedPRs(_ context.Context) ([]PullRequest, error)
- func (c *GhCli) UpdatePRBase(_ context.Context, number int, newBase string) error
- func (c *GhCli) UpdatePRBody(_ context.Context, number int, body string) error
- func (c *GhCli) UpdatePRTitle(_ context.Context, number int, newTitle string) error
- type GitHubClient
- type MockGhClient
- func (m *MockGhClient) CreatePR(_ context.Context, p NewPR) (PullRequest, error)
- func (m *MockGhClient) CurrentUser(_ context.Context) (string, error)
- func (m *MockGhClient) GetPR(_ context.Context, number int) (PullRequest, error)
- func (m *MockGhClient) ListAllOpenPRs(_ context.Context) ([]PullRequest, error)
- func (m *MockGhClient) ListMergedPRsByHead(_ context.Context, heads []string) ([]PullRequest, error)
- func (m *MockGhClient) ListOpenPRs(_ context.Context) ([]PullRequest, error)
- func (m *MockGhClient) ListReviewRequestedPRs(_ context.Context) ([]PullRequest, error)
- func (m *MockGhClient) SetReviewRequested(numbers ...int)
- func (m *MockGhClient) SetState(number int, state string)
- func (m *MockGhClient) UpdatePRBase(_ context.Context, number int, newBase string) error
- func (m *MockGhClient) UpdatePRBody(_ context.Context, number int, body string) error
- func (m *MockGhClient) UpdatePRTitle(_ context.Context, number int, newTitle string) error
- type NewPR
- type PullRequest
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 (*GhCli) ListAllOpenPRs ¶ added in v0.1.4
func (c *GhCli) ListAllOpenPRs(_ context.Context) ([]PullRequest, error)
func (*GhCli) ListMergedPRsByHead ¶
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 (*GhCli) UpdatePRBody ¶
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 (*MockGhClient) UpdatePRBody ¶
func (*MockGhClient) UpdatePRTitle ¶ added in v0.1.5
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
}
Click to show internal directories.
Click to hide internal directories.