Help us shape the future of Go! Take the 2026 Go Developer Survey

prmergetest

package
v8.161.13 Latest Latest
Warning

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

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

Documentation

Overview

Package prmergetest is an in-process test double of what a merge reads from and writes to GitHub: a prmerge.GitHub answering from state a test sets, the wait's reads those of prwaittest.GitHub. A merge call merges the pull request: every read after it answers it merged.

Index

Constants

View Source
const Login = "someone"

Login is the login the double's token acts as and its pull requests' author, unless a test says otherwise.

Variables

This section is empty.

Functions

func Policy

func Policy(optedOut bool) prmerge.Policy

Policy is the opt-out of a repository whose team-file entry says agentMerge: false when optedOut, as prmerge.TeamFilePolicy words it.

func PullRequest

func PullRequest(owner, repo string, number int, sha, author string) *github.PullRequest

PullRequest is owner/repo#number, open and clean, its head sha on the branch feature of the same repository, opened by author an hour ago.

Types

type GitHub

type GitHub struct {
	*prwaittest.GitHub
	// Login is who the token acts as; empty is [Login].
	Login string
	// MergeCommitSHA is the commit a merge call produces.
	MergeCommitSHA string
	// Settings are the repository's merge settings; nil allows every
	// method.
	Settings *github.Repository
	// contains filtered or unexported fields
}

GitHub is a prmerge.GitHub over one pull request, PR of the embedded wait double, which a test sets (PullRequest is one).

func New

func New(pr *github.PullRequest, heads ...prwaittest.Head) *GitHub

New is the double of pr, whose head carries heads at each poll.

func (*GitHub) BehindBy

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

func (*GitHub) CommitTime

func (g *GitHub) CommitTime(context.Context, string, string, string) (time.Time, error)

func (*GitHub) CurrentLogin

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

func (*GitHub) DefaultBranch

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

func (*GitHub) DeleteBranch

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

func (*GitHub) DispatchWorkflow

func (g *GitHub) DispatchWorkflow(context.Context, string, string, string, string, map[string]any) error

func (*GitHub) EnqueuePullRequest

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

func (*GitHub) IsPullRequest

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

func (*GitHub) IssueComments

func (g *GitHub) IssueComments(context.Context, string, string, int) ([]*github.IssueComment, error)

func (*GitHub) MergePullRequest

func (g *GitHub) MergePullRequest(_ context.Context, _, _ string, _ int, opts githubclient.MergeOptions) (string, error)

func (*GitHub) MergeQueueRequired

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

func (*GitHub) Merges

func (g *GitHub) Merges() []githubclient.MergeOptions

Merges are the merge calls made, in order.

func (*GitHub) OrganizationRuleset

func (g *GitHub) OrganizationRuleset(context.Context, string, int64) (*github.RepositoryRuleset, error)

func (*GitHub) PullRequest

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

PullRequest is the wait double's pull request, merged once a merge call merged it.

func (*GitHub) PullRequestReviewComments

func (g *GitHub) PullRequestReviewComments(context.Context, string, string, int) ([]*github.PullRequestComment, error)

func (*GitHub) PullRequestReviews

func (g *GitHub) PullRequestReviews(context.Context, string, string, int) ([]*github.PullRequestReview, error)

func (*GitHub) RebasePullRequestBranch

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

func (*GitHub) Repository

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

func (*GitHub) RepositoryRuleset

func (g *GitHub) RepositoryRuleset(context.Context, string, string, int64) (*github.RepositoryRuleset, error)

func (*GitHub) RulesForBranch

func (g *GitHub) RulesForBranch(context.Context, string, string, string) (*github.BranchRules, error)

func (*GitHub) UpdatePullRequestBranch

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

Jump to

Keyboard shortcuts

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