proposal

package
v0.21.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package proposal renders the Release merge request: its title and its body.

The body is machine-owned output, regenerated wholesale on every run exactly like the branch it describes. Colophon never reads it back.

That is a deliberate divergence from releaser-pleaser, which takes overrides from fenced blocks in its own merge-request body. Under a fast-forward merge a merge-request body never reaches git history unless the person merging chooses to squash, and squashing is optional here rather than required — so anything colophon must still know after the merge has to live in the repository. The version override is a `Release-As:` commit trailer and the settings are in `.colophon.yaml`, both of which survive any merge method.

Rendering is pure: it takes data and returns strings.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingField = errors.New("release proposal: missing required field")

ErrMissingField reports a required input absent from an Input.

Functions

func IsRelease added in v0.20.1

func IsRelease(c policy.Commit, target string) bool

IsRelease reports whether c is the release commit TitleTags writes for target, whatever tags it names.

func Subject added in v0.5.0

func Subject(tags []string) string

Subject is the part of the title after the scope, which is what `guardAlreadyReleased` compares against the target's tip.

func Title

func Title(tag, target string) (string, error)

Title is the merge request's title, and also the release commit's message so the two cannot describe different releases.

It is separate from Render because the caller needs it BEFORE the body: the release branch is committed with this message, and only once that commit exists is the base known that the body reports.

It takes the tag, not the version, because only the scheme knows how one becomes the other: rtb-error-v0.6.4 is not "v" + 0.6.4 (spec 0027 D1).

func TitleTags added in v0.5.0

func TitleTags(target string, tags []string) (string, error)

TitleTags is the release commit's subject for every tag the request proposes, root first: `chore(main): release v1.2.0 lint/v0.7.0`. A request carrying one root tag reads exactly as Title does (spec 0010 D5).

Types

type Input

type Input struct {
	// Version is the version being proposed, with or without a leading "v".
	Version string

	// Tags names every tag the request proposes, root first. When set, the
	// title is built from them; Version alone means one root tag.
	Tags []string

	// Target is the branch being released from, and names the title's scope.
	Target string

	// Changelog is the already-rendered changelog section.
	Changelog string

	// Base is the target commit the release branch was cut from, reported so a
	// reader can see which state of the target the proposal describes.
	Base string

	// Considered is how many commits were examined to reach this decision.
	Considered int
}

Input is everything the body needs. All of it is data: nothing here reads a repository or a forge.

func (Input) TitleOnly added in v0.5.0

func (in Input) TitleOnly() (string, error)

TitleOnly is the title Render would give, for a caller that needs it before the body exists: the release commit is written with it.

type Proposal

type Proposal struct {
	Title string
	Body  string
}

Proposal is the rendered merge request.

func Render

func Render(in Input) (Proposal, error)

Render builds the merge request's title and body.

Jump to

Keyboard shortcuts

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