reland

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package reland relands a bot's dependency pull request as the person's own commit (iss-2611220952509874): the hand step the dependency-reauthor workflow leaves to a person while its owner or its App is unset.

The bound is the workflow's own. The pull request is judged by the scaffolded dependency-reauthor script, run in its `check` mode against the declaration origin's default branch stores, so the bot, the branch prefix, the one commit and the declared manifests are decided by one parser and one check, never a second copy here. What passes is applied onto a fresh branch from origin's default branch, read as stored, committed under the checkout's own git identity, and left local: the person lands it with `abcd land`.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDeclaration = errors.New("the repository declares no dependency re-authoring (" + scaffold.ReauthorConfPath + ")")

ErrNoDeclaration is what a read of a checkout without the declaration answers: the repository has not opted in to re-authoring.

Functions

This section is empty.

Types

type Declaration

type Declaration struct {
	OwnerSet bool  `json:"owner_set"`
	Rows     []Row `json:"rows"`
}

Declaration is the re-authoring declaration as the script parsed it: whether its owner is set, and its rows.

func (Declaration) Matches

func (d Declaration) Matches(author, head string) (Row, bool)

Matches reports the row a pull request by author from branch head falls under: the author is the row's bot and the branch starts with its prefix. It is the listing's first cut, never the bound: the script judges that.

type Fetched

type Fetched struct {
	OwnerSet bool     `json:"owner_set"`
	Branches []string `json:"branches"`
}

Fetched is what the status board says of the bumps waiting on a reland, from disk alone (adr-38): the declaration, and origin's branches under a declared prefix as this checkout last fetched them.

func AsFetched

func AsFetched(root string) (Fetched, error)

AsFetched reads the declaration in root's working tree and the remote-tracking branches under refs/remotes/origin/ that start with one of its prefixes. A checkout without the declaration answers ErrNoDeclaration. The branches are as last fetched: a bump merged or closed since stays listed until a fetch prunes its branch.

type Forge

type Forge struct {
	ReadPR func(root string, n int) (PullRequest, error)
	Pusher func(ctx context.Context, root, ref, sha string) (string, error)
	// ListOpen lists the repository's open pull requests (List).
	ListOpen func(root string) ([]PullRequest, error)
}

Forge is how the forge is asked. ReadPR reads one pull request; Pusher names the account whose push last moved ref (a full refs/heads/ ref) to sha, the workflow's "actor".

func DefaultForge

func DefaultForge() Forge

DefaultForge is GitHub through abcd's one door to its API (internal/core/github): the caller's own `gh`, on the repository origin names.

type Options

type Options struct {
	// Root is the checkout the branch is made in.
	Root string
	// PR is the bot's pull request.
	PR int
	// AssistedBy is the model form of the disclosure trailer
	// (`<Vendor>:<model-version>`) when an agent runs the reland; "" writes
	// `Assisted-by: None`.
	AssistedBy string
	// Forge asks the forge; its zero members are GitHub's (DefaultForge).
	Forge Forge
	// Fetch runs one networked git command from the checkout; nil is
	// gitutil.Net.
	Fetch func(dir string, args ...string) (string, error)
}

Options is one reland.

type PullRequest

type PullRequest struct {
	Number int    `json:"number"`
	Title  string `json:"title"`
	State  string `json:"state"`
	// Author is the opener's login (`dependabot[bot]` for Dependabot).
	Author string `json:"author"`
	// HeadRef and HeadSHA are the branch and the commit it holds.
	HeadRef string `json:"head_ref"`
	HeadSHA string `json:"head_sha"`
	// HeadRepo is the repository the branch lives in, as owner/name, and
	// Repo the one the pull request is opened on.
	HeadRepo string `json:"head_repo"`
	Repo     string `json:"repo"`
}

PullRequest is what the forge says of one pull request: what the dependency-reauthor workflow fills its environment from.

type Refusal

type Refusal struct{ Reason string }

Refusal is a reland refused: the pull request is outside the bound, its change does not apply, or the checkout's identity is a machine's. Nothing was written.

func (*Refusal) Error

func (r *Refusal) Error() string

type Result

type Result struct {
	PR         int    `json:"pull_request"`
	Subject    string `json:"subject"`
	Superseded string `json:"superseded_head"`
	Default    string `json:"default_branch"`
	Base       string `json:"base"`
	Branch     string `json:"branch"`
	Commit     string `json:"commit"`
	Author     string `json:"author"`
	Bound      string `json:"bound"`
	Next       string `json:"next"`
}

Result is a reland made.

func Reland

func Reland(o Options) (Result, error)

Reland relands pull request o.PR as the checkout's own commit: it asks the forge for the pull request, fetches origin's default branch and the pull request's branch, judges it with the workflow's script against the declaration the default branch stores, applies the bot's commit onto the default branch's tip as stored (a three-way merge from the commit's own parent, writing no working tree), and commits the result under the checkout's git identity on a new local branch. It pushes nothing and opens nothing.

type Row

type Row struct {
	Bot       string   `json:"bot"`
	Prefix    string   `json:"prefix"`
	Directory string   `json:"directory"`
	Files     []string `json:"files"`
}

Row is one ecosystem row of the declaration, as the script parsed it.

type Waiting

type Waiting struct {
	Declaration Declaration   `json:"declaration"`
	Bumps       []PullRequest `json:"bumps"`
	// Truncated is a listing that read a full page, so more may be open.
	Truncated bool `json:"truncated,omitempty"`
}

Waiting is the listing: the declaration and the open pull requests that fall under one of its rows, each a bump a person relands while the workflow cannot.

func List

func List(root string, f Forge) (Waiting, error)

List asks the forge for the open pull requests a declared bot opened from a declared prefix in this repository: the bumps waiting on a reland.

Jump to

Keyboard shortcuts

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