Documentation
¶
Overview ¶
Package prwaittest is an in-process test double of what a pull request wait reads from GitHub: a prwait.GitHub answering from state a test sets, one head state per poll.
Index ¶
- func CheckRun(name, status, conclusion string) *github.CheckRun
- func OpenPullRequest(number int, sha string, updated time.Time) *github.PullRequest
- func Status(context, state string) *github.RepoStatus
- func WorkflowRun(name, file, status, conclusion string) *github.WorkflowRun
- type GitHub
- func (g *GitHub) CheckRollup(context.Context, string, string, string) ([]*github.CheckRun, []*github.RepoStatus, error)
- func (g *GitHub) CheckRunsForRef(context.Context, string, string, string) ([]*github.CheckRun, error)
- func (g *GitHub) CommitMessage(context.Context, string, string, string) (string, error)
- func (g *GitHub) CommitStatuses(context.Context, string, string, string) ([]*github.RepoStatus, error)
- func (g *GitHub) FileExists(_ context.Context, _, _, file, _ string) (bool, error)
- func (g *GitHub) InactiveWorkflowPaths(context.Context, string, string) (map[string]bool, error)
- func (g *GitHub) JobLog(_ context.Context, _, _ string, jobID int64) (io.ReadCloser, error)
- func (g *GitHub) ListDirectory(_ context.Context, _, _, dir, _ string) ([]string, error)
- func (g *GitHub) Polls() int
- func (g *GitHub) PullRequest(_ context.Context, _, _ string, number int) (*github.PullRequest, error)
- func (g *GitHub) ReadFile(_ context.Context, _, _, file, _ string) ([]byte, bool, error)
- func (g *GitHub) RequiredStatusContexts(context.Context, string, string, string) ([]string, error)
- func (g *GitHub) ReviewDecision(context.Context, string, string, int) (string, error)
- func (g *GitHub) WorkflowRunsForSHA(context.Context, string, string, string) ([]*github.WorkflowRun, error)
- type Head
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenPullRequest ¶
OpenPullRequest is an open pull request of head sha, updated at updated.
func Status ¶
func Status(context, state string) *github.RepoStatus
Status is a commit status of context in state.
func WorkflowRun ¶
func WorkflowRun(name, file, status, conclusion string) *github.WorkflowRun
WorkflowRun is an Actions run of the workflow at file in status, with conclusion once completed, started by a pull_request event.
Types ¶
type GitHub ¶
type GitHub struct {
// PR is the pull request; nil is an open one, its head "abc123"
// on "feature", its base "main", last updated an hour ago.
PR *github.PullRequest
// Heads are the head's states, one per poll; none is a head without
// any check.
Heads []Head
// Required are the contexts the base requires.
Required []string
// Decision is GraphQL's reviewDecision of the pull request.
Decision string
// Files are the repository's files at the head by path: its workflows
// under .github/workflows.
Files map[string]string
// Message is the head commit's message.
Message string
// contains filtered or unexported fields
}
GitHub is a prwait.GitHub over the state of one pull request. Each read of the pull request starts a poll; the poll reads Heads at its index, the last one once the polls run past them.
func (*GitHub) CheckRollup ¶
func (*GitHub) CheckRunsForRef ¶
func (*GitHub) CommitMessage ¶
func (*GitHub) CommitStatuses ¶
func (*GitHub) FileExists ¶
func (*GitHub) InactiveWorkflowPaths ¶
func (*GitHub) ListDirectory ¶
func (*GitHub) PullRequest ¶
func (*GitHub) RequiredStatusContexts ¶
func (*GitHub) ReviewDecision ¶
type Head ¶
type Head struct {
CheckRuns []*github.CheckRun
Statuses []*github.RepoStatus
WorkflowRuns []*github.WorkflowRun
}
Head is what a pull request's head carries at one poll.