Skip to content

changelog

Turn commit history into a changelog — and read one back into a typed model. changelog walks a repository's Conventional Commits to generate a categorised changelog, and parses an existing release-notes document into ChangelogReleaseEntry you can query.

go get gitlab.com/phpboyscout/go/changelog
// Generate from the repo's tags and commits.
md, err := changelog.GenerateFromRepo(".", changelog.WithSinceTag("v1.2.0"))

// Parse existing notes and inspect them.
cl, err := changelog.Parse(rawNotes) // ErrNoReleases when nothing parseable
if cl.HasBreakingChanges() {
    // ...
}

It is a library, not a command: there is no binary, no configuration file and no environment variable. Everything that varies is an argument.

Start here

Two halves

  • Generate from git historyGenerateFromRepo opens the repo with go-git, reads tags and commits, classifies each Conventional Commit, and renders newest-first markdown. Bound it with WithSinceTag or WithMaxReleases; keep non-conforming commit messages with WithIncludeAll.
  • Parse existing release notesParse and ParseFromArchive turn a markdown changelog (or a gzip/tar release archive) back into a typed Changelog, with HasBreakingChanges, BreakingChanges, and EntriesByCategory to query it and FormatSummary to render a short summary.

How commits become entries

Each commit subject is classified into a Category — breaking, feature, fix, performance, or other — with its scope and description pulled out, and attributed to the earliest release whose tag can reach it. Releases are ordered by semver, newest first.

Look something up

The reference section covers every option and its default, the exact markdown emitted, the exact markdown accepted, and every error value. Go signatures live on pkg.go.dev.

Before designing around it, read what changelog does not do — no CLI, no templating, no commit links, no path or scope filtering, and nothing read from the commit body but the breaking-change footer.

No framework weight

The whole dependency graph is go-git, the leodido conventional-commits parser, x/mod, and cockroachdb/errors — enforced by a depfootprint test.

Further reading

The blog carries a curated route through this subject: CI/CD, and getting things released collects everything written about it, ordered so you can start at the beginning rather than newest-first.

Ask phpbotscout

phpbotscout

He answers questions about the projects over on the Discord, citing the docs where they already cover it, and offering to raise an issue where they don't. Bring a bug, an idea, or a questionable engineering decision.

Join the Discord