prwaittest

package
v8.162.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRun

func CheckRun(name, status, conclusion string) *github.CheckRun

CheckRun is a check run of name in status, with conclusion once completed.

func OpenPullRequest

func OpenPullRequest(number int, sha string, updated time.Time) *github.PullRequest

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 (g *GitHub) CheckRunsForRef(context.Context, string, string, string) ([]*github.CheckRun, error)

func (*GitHub) CommitMessage

func (g *GitHub) CommitMessage(context.Context, string, string, string) (string, error)

func (*GitHub) CommitStatuses

func (g *GitHub) CommitStatuses(context.Context, string, string, string) ([]*github.RepoStatus, error)

func (*GitHub) FileExists

func (g *GitHub) FileExists(_ context.Context, _, _, file, _ string) (bool, error)

func (*GitHub) InactiveWorkflowPaths

func (g *GitHub) InactiveWorkflowPaths(context.Context, string, string) (map[string]bool, error)

func (*GitHub) JobLog

func (g *GitHub) JobLog(_ context.Context, _, _ string, jobID int64) (io.ReadCloser, error)

func (*GitHub) ListDirectory

func (g *GitHub) ListDirectory(_ context.Context, _, _, dir, _ string) ([]string, error)

func (*GitHub) Polls

func (g *GitHub) Polls() int

Polls is how many polls read the pull request.

func (*GitHub) PullRequest

func (g *GitHub) PullRequest(_ context.Context, _, _ string, number int) (*github.PullRequest, error)

func (*GitHub) ReadFile

func (g *GitHub) ReadFile(_ context.Context, _, _, file, _ string) ([]byte, bool, error)

func (*GitHub) RequiredStatusContexts

func (g *GitHub) RequiredStatusContexts(context.Context, string, string, string) ([]string, error)

func (*GitHub) ReviewDecision

func (g *GitHub) ReviewDecision(context.Context, string, string, int) (string, error)

func (*GitHub) WorkflowRunsForSHA

func (g *GitHub) WorkflowRunsForSHA(context.Context, string, string, string) ([]*github.WorkflowRun, error)
type Head struct {
	CheckRuns    []*github.CheckRun
	Statuses     []*github.RepoStatus
	WorkflowRuns []*github.WorkflowRun
}

Head is what a pull request's head carries at one poll.

Jump to

Keyboard shortcuts

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