conventional

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncVersion

func IncVersion(info VersionInfo, config VersionConfig, increment Increment) (*semver.Version, error)

IncVersion increments the version based on the current version, the current release candidate, and the configuration

Types

type Commits

Commits is a struct that contains the commits for breaking changes, features, and fixes based on the conventional commit types.

func ParseCommits

func ParseCommits(commits map[string]*github.RepositoryCommit) (parsed Commits)

ParseCommits parses the commits and returns the version increment and associated commits for breaking changes, features, and fixes.

The parser is configured to use the best effort mode. The best effort mode will make the parser return what it found until the point it errored out, if it found (at least) a valid type and a valid description. However, if the parser does not find a valid type or a valid description, it will not account for the commit.

See: https://github.com/leodido/go-conventionalcommits?tab=readme-ov-file#best-effort

Parameters:

  • commits: The commits to parse.

Returns:

  • parsed (Commits): The parsed commits.

func (*Commits) Increment

func (c *Commits) Increment() Increment

Increment returns the increment type based on the collection of commits. If there are any breaking changes, the increment type is Major. If there are any features, the increment type is Minor. If there are any fixes, the increment type is Patch. Otherwise, the increment type is -1, indicating no increment is necessary.

type Increment

type Increment int

Increment is a type that represents the type of increment to make to the version.

const (
	Major Increment = iota
	Minor
	Patch
)

type Message

func (*Message) IsBuild

func (m *Message) IsBuild() bool

func (*Message) IsCI

func (m *Message) IsCI() bool

func (*Message) IsChore added in v1.1.0

func (m *Message) IsChore() bool

func (*Message) IsDebug

func (m *Message) IsDebug() bool

func (*Message) IsDocs

func (m *Message) IsDocs() bool

func (*Message) IsPerf

func (m *Message) IsPerf() bool

func (*Message) IsRefactor

func (m *Message) IsRefactor() bool

func (*Message) IsStyle

func (m *Message) IsStyle() bool

func (*Message) IsTest

func (m *Message) IsTest() bool

type Parser

type Parser struct {
	conventionalcommits.Machine
}

Parser is a struct that contains the parser for conventional commit messages.

func (*Parser) ParseCommit

func (p *Parser) ParseCommit(commit *github.RepositoryCommit) (out *conventionalcommits.ConventionalCommit)

ParseCommit parses the commit message and returns the conventional commit message.

type VersionConfig

type VersionConfig struct {
	DefaultBranch        string // The default branch for the repository
	BaseBranch           string // The current branch version to increment
	PrereleaseIdentifier string // The prerelease tag to use for prerelease versions
}

VersionConfig is a struct that contains the configuration for the versioning process

type VersionInfo

type VersionInfo struct {
	CurrentVersion          *semver.Version
	CurrentReleaseCandidate *semver.Version
}

VersionInfo is a struct that contains the current version and the current release candidate version

Jump to

Keyboard shortcuts

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