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 Changelog → Release → Entry you can query.
// Generate from the repo's tags and commits.
md, err := changelog.GenerateFromRepo(".", changelog.WithSinceTag("v1.2.0"))
// Parse existing notes and inspect them.
cl := changelog.Parse(rawNotes)
if cl.HasBreakingChanges() {
// ...
}
Two halves¶
- Generate from git history —
GenerateFromRepoopens the repo with go-git, reads tags and commits, classifies each Conventional Commit, and renders newest-first markdown. Bound it withWithSinceTag,WithMaxReleases, or take everything withWithIncludeAll. - Parse existing release notes —
ParseandParseFromArchiveturn a markdown changelog (or a gzip/tar release archive) back into a typedChangelog, withHasBreakingChanges,BreakingChanges, andEntriesByCategoryto query it andFormatSummaryto render a short summary.
How commits become entries¶
Each commit is classified into a Category — breaking, feature, fix, performance, or
other — with its scope and description pulled out. Releases are ordered by semver, newest
first. The rules (and why test/ci are dropped, how breaking changes are detected) are
in Conventional Commits & categorisation.
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. Start with
Getting started; the full API is on
pkg.go.dev.