analyzeCommits
Analyses a list of commits to suggest a semantic version bump.
Each commit is parsed via parseConventionalCommit. The body is also
scanned for BREAKING CHANGE: / BREAKING-CHANGE: markers. The bump rule
is:
- any breaking change →
'major' - otherwise any
feat→'minor' - otherwise any
fix→'patch' - otherwise (non-empty list of non-conventional commits) →
'patch' - empty list →
'patch'with reason “No commits to analyse”
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
commits | readonly AnalyzableCommit[] | Iterable of commits to analyse. Only `subject` is required. |
Returns
Section titled “Returns”CommitAnalysis — Aggregated analysis with the suggested bump and reason.
Examples
Section titled “Examples”Suggest a semver bump from a list of commits
Section titled “Suggest a semver bump from a list of commits”Walks through commits and suggests major, minor, or patch based on Conventional Commits.
Promote to major on breaking change
Section titled “Promote to major on breaking change”A ! marker or a BREAKING CHANGE: footer always promotes the suggestion to major.
Related Types
Section titled “Related Types”AnalyzableCommit
Section titled “AnalyzableCommit”Minimal commit shape consumed by analyzeCommits. Only the subject line is
mandatory; the body is scanned for a BREAKING CHANGE footer.
CommitAnalysis
Section titled “CommitAnalysis”Aggregated result of analyzeCommits.
CommitVersionBump
Section titled “CommitVersionBump”Bumping suggestion produced by analyzeCommits.
