conventionalcommits

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConventionalCommit

type ConventionalCommit struct {
	// Type is the type of change (e.g., "feat", "fix", "docs").
	Type string `yaml:"type" json:"type"`
	// Subject is the short summary of the change.
	Subject string `yaml:"subject" json:"subject"`
	// Body is the long-form description of the change.
	Body string `yaml:"body" json:"body"`
	// LibraryID is the library ID the commit associated with.
	LibraryID string `yaml:"-" json:"-"`
	// Scope is the scope of the change.
	Scope string `yaml:"-" json:"-"`
	// Footers contain metadata (e.g,"BREAKING CHANGE", "Reviewed-by").
	Footers map[string]string `yaml:"-" json:"-"`
	// IsBreaking indicates if the commit introduces a breaking change.
	IsBreaking bool `yaml:"-" json:"-"`
	// IsNested indicates if the commit is a nested commit.
	IsNested bool `yaml:"-" json:"-"`
	// SHA is the full commit hash.
	// Deprecated: use CommitHash instead.
	SHA string `yaml:"-" json:"source_commit_hash,omitempty"`
	// CommitHash is the full commit hash.
	CommitHash string `yaml:"-" json:"commit_hash,omitempty"`
	// When is the timestamp of the commit.
	When time.Time `yaml:"-" json:"-"`
}

ConventionalCommit represents a parsed conventional commit message. See https://www.conventionalcommits.org/en/v1.0.0/ for details.

func ParseCommits

func ParseCommits(commit *gitrepo.Commit, libraryID string) ([]*ConventionalCommit, error)

ParseCommits parses a commit message into a slice of ConventionalCommit structs.

It supports an override block wrapped in BEGIN_COMMIT_OVERRIDE and END_COMMIT_OVERRIDE. If found, this block takes precedence, and only its content will be parsed.

The message can also contain multiple nested commits, each wrapped in BEGIN_NESTED_COMMIT and END_NESTED_COMMIT markers.

Malformed override or nested blocks (e.g., with a missing end marker) are ignored. Any commit part that is found but fails to parse as a valid conventional commit is logged and skipped.

func (*ConventionalCommit) MarshalJSON

func (c *ConventionalCommit) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaler for ConventionalCommit.

Jump to

Keyboard shortcuts

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