Documentation
¶
Overview ¶
Package changelog generates release changelogs from conventional commit history, parsing commits into typed entries and enriching authors with GitHub usernames for release notes.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMarkdown ¶
func FormatMarkdown(breaking, features, fixes []ConventionalCommit, other []git.Commit, repo, baseSHA, headSHA string) string
FormatMarkdown generates a markdown changelog with emoji headers, scope grouping, and collapsible sections
func IsRoutineType ¶
IsRoutineType returns true for commit types that should be skipped in changelog
func LookupGitHubUsernames ¶
LookupGitHubUsernames looks up GitHub usernames for commits via a single GraphQL query. It deduplicates by author email, so 500 commits by 5 authors results in 1 API call.
func NewCommand ¶
NewCommand creates the generate-changelog command
Types ¶
type ChangelogResult ¶
type ChangelogResult struct {
Changelog string `json:"changelog"`
HasBreaking bool `json:"has_breaking"`
HasFeatures bool `json:"has_features"`
HasFixes bool `json:"has_fixes"`
}
ChangelogResult is the output of generate-changelog command
type ConventionalCommit ¶
type ConventionalCommit struct {
Type string // feat, fix, docs, chore, etc.
Scope string // optional scope in parentheses
Breaking bool // has ! or BREAKING CHANGE
Description string // the commit description
Hash string // short hash
FullHash string // full hash
Author string // commit author name
AuthorEmail string // author email for deduplication
GitHubUsername string // GitHub username (looked up via API)
PRNumber string // PR number if present in description (e.g., "#123")
}
ConventionalCommit represents a parsed conventional commit
func CategorizeCommits ¶
func CategorizeCommits(commits []git.Commit) (breaking, features, fixes []ConventionalCommit, other []git.Commit)
CategorizeCommits groups commits by type
func LookupConventionalCommitUsernames ¶
func LookupConventionalCommitUsernames(commits []ConventionalCommit, repo string) []ConventionalCommit
LookupConventionalCommitUsernames looks up GitHub usernames for conventional commits
func ParseCommit ¶
func ParseCommit(commit git.Commit) *ConventionalCommit
ParseCommit parses a git commit into a ConventionalCommit
Example ¶
cc := ParseCommit(git.Commit{
Hash: "1234567890abcdef",
Subject: "feat(api): add retry support (#42)",
Author: "Ada Lovelace",
})
fmt.Printf("%s(%s): %s [PR %s]\n", cc.Type, cc.Scope, cc.Description, cc.PRNumber)
Output: feat(api): add retry support [PR 42]