labels

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: 7 Imported by: 0

Documentation

Overview

Package labels offers to create the labels a release merge request asks for when the forge does not have them yet (spec 0029 D9).

go/forge never creates a label as a side effect of using one, so creation is a separate act here, taken only on a yes from a person at a prompt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Labels   forge.Labels
	Creator  forge.LabelCreator
	Prompter Prompter

	// Out is where a refusal is reported, between one question and the next.
	Out io.Writer

	// Namespace and Repository are what the forge calls them: "group" and
	// "project" on GitLab, "organisation" and "repository" elsewhere.
	Namespace  string
	Repository string

	// Descriptions are given to labels created by those names. Any other label
	// is created with a name only, because colophon cannot know what a
	// project's own label means.
	Descriptions map[string]string
}

Config is what a Preparer needs.

type Preparer

type Preparer struct {
	// contains filtered or unexported fields
}

Preparer offers to create the missing labels, at every level the forge supports, before a merge request is opened.

func New

func New(cfg Config) *Preparer

New returns a Preparer.

func (*Preparer) Prepare

func (p *Preparer) Prepare(ctx context.Context, owner, repo string, want []string) error

Prepare makes sure the wanted labels exist, asking first. A refusal at one level offers the narrower ones; a decline, or a refusal at every level, leaves the labels missing for the forge to report when the merge request is opened.

type Prompter

type Prompter interface {
	Choose(ctx context.Context, question string, options []string) (int, error)
}

Prompter asks one question and returns the index of the option chosen.

Jump to

Keyboard shortcuts

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