git

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitsSince

func CommitsSince(tag string) ([]string, error)

CommitsSince retrieves the list of commit messages since the specified Git tag up to HEAD.

func GenerateChangelog

func GenerateChangelog(tagBranch string, hotfix bool, skipTypes []string, skipScopes []string) (string, error)

GenerateChangelog is a high-level helper that orchestrates generating the changelog text based on common inputs you would pass via CLI flags.

It performs the following steps:

  1. Determine the latest tag reachable from the given branch.
  2. Compute the next version (minor bump by default, patch when hotfix).
  3. Collect commits since the latest tag and render the changelog.

Parameters:

  • tagBranch: branch on which to search the latest tag (defaults to "main" if empty)
  • hotfix: whether to bump PATCH instead of MINOR
  • skipTypes: Conventional Commit types to omit (e.g., feat, fix, chore)
  • skipScopes: scopes to omit from the output

Returns the rendered changelog, or an error.

func LatestTag

func LatestTag(branch string) (string, error)

LatestTag retrieves the most recent Git tag reachable from the given branch. If branch is empty, it uses "main" by default. It returns the latest tag as a string.

func NextTag

func NextTag(tagBranch string, hotfix bool) (string, error)

NextTag returns the next semantic version tag based on the latest tag found on the given branch. When hotfix is true, a PATCH increment is performed; otherwise MINOR is incremented and PATCH reset to 0.

func NextVersion

func NextVersion(tag string, hotfix bool) (string, error)

NextVersion calculates the next version using golang.org/x/mod/semver. It expects a semantic version tag like 'vMAJOR.MINOR.PATCH'. When hotfix is true, the PATCH component is incremented; otherwise the MINOR component is incremented and PATCH reset to 0. The returned version is a canonical semver starting with 'v'.

func RenderChangelog

func RenderChangelog(tag string, commits []string, skipTypes []string, skipScopes []string) string

RenderChangelog processes a list of commit messages and organizes them into categorized changelog sections. The tag parameter is the next version tag to include in the heading. Use skipTypes to omit certain Conventional Commit types and skipScopes to omit specific scopes from the output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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