changelog

package
v8.141.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package changelog keeps a Keep a Changelog file's Unreleased section to the changes no release carries yet.

Auto Release tags a release from every releasable merge, and the entry the merged pull request added under Unreleased is part of that release: the CHANGELOG.md of the tag lists it under Unreleased. Cut moves every such entry into the section of the release that first carried it; Check lists them.

Only Unreleased and the sections receiving entries are rewritten: every other section, the preamble and the link references keep their bytes.

Index

Constants

View Source
const Unreleased = "Unreleased"

Unreleased is the name of the section holding the changes no release carries.

Variables

This section is empty.

Functions

func HasUnreleased

func HasUnreleased(text string) bool

HasUnreleased reports whether text has an Unreleased section to cut.

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

Types

type Moved

type Moved struct {
	// Release is the tag of the release that carried the entry first.
	Release string
	// Entry is the entry's text, its bullet line and the lines continuing it.
	Entry string
}

Moved is an entry Cut moved out of Unreleased.

func Cut

func Cut(text string, releases []Release) (string, []Moved)

Cut moves every Unreleased entry a release already carried into that release's section, creating the section (and its link reference, when the file keeps them) where it is missing, and returns the new text and the moved entries. A text without an Unreleased section is returned unchanged. An entry added again after a release carried it once stays: a release is credited only with the copies its CHANGELOG.md holds beyond the previous release's.

func (Moved) Summary

func (m Moved) Summary(n int) string

Summary is the entry's first line, at most n runes.

type Release

type Release struct {
	// Version is the release's version without the tag's "v".
	Version *semver.Version
	// Tag is the tag the release is named by.
	Tag string
	// Date is the tagged commit's date, YYYY-MM-DD.
	Date string
	// Changelog is the CHANGELOG.md at the tag; empty when the tag has none.
	Changelog string
}

Release is one release as cut: the tags on one commit are one release, named by the highest version among them (a promoted release candidate by its final version).

func Releases

func Releases(dir, path string) ([]Release, error)

Releases reads the releases reachable from HEAD in the git repository at dir: its "v"-prefixed semver tags, the tags on one commit as one release, and each tag's file at path (CHANGELOG.md), relative to dir.

Jump to

Keyboard shortcuts

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