parser

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package parser provides functions to parse a Git repository commit history.

This package is used to compute the semantic version number from a formatted Git repository commit history. To do so, it expects the commit history to follow the Conventional Commits specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeNewSemverOutput

type ComputeNewSemverOutput struct {
	Semver     *semver.Version
	Project    monorepo.Project
	Branch     string
	CommitHash plumbing.Hash
	NewRelease bool
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func New

func New(ctx *appcontext.AppContext) *Parser

func (*Parser) ComputeNewSemver

func (p *Parser) ComputeNewSemver(repository *git.Repository, project monorepo.Project, branch branch.Branch) (ComputeNewSemverOutput, error)

ComputeNewSemver returns the next, if any, semantic version number from a given Git repository by parsing its commit history.

func (*Parser) FetchLatestSemverTag

func (p *Parser) FetchLatestSemverTag(repository *git.Repository, project monorepo.Project) (*object.Tag, error)

FetchLatestSemverTag parses a Git repository to fetch the tag corresponding to the highest semantic version number among all tags.

func (*Parser) ProcessCommit

func (p *Parser) ProcessCommit(commit *object.Commit, latestSemver *semver.Version, project monorepo.Project) (bool, plumbing.Hash, error)

ProcessCommit parse a commit message and bump the latest semantic version accordingly.

func (*Parser) Run

func (p *Parser) Run(ctx context.Context, repository *git.Repository) ([]ComputeNewSemverOutput, error)

Run execute a parser on a repository and analyze the given branches and projects contained inside the given AppContext.

Jump to

Keyboard shortcuts

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