commit

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package commit parses Conventional Commit messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasSkipChangelogTag

func HasSkipChangelogTag(message string) bool

HasSkipChangelogTag reports whether message contains a "[skip changelog]" tag, case-insensitive and anywhere in the message text — the same "[skip ci]"-style convention CI systems use, so it works in a single-line "git commit -m" without needing a footer trailer. This is a fixed, non-configurable literal, unlike cfg.SkipChangelogTrailer's footer key.

func Trailers

func Trailers(message string) map[string]string

Trailers returns the git-trailer-style footer of a commit message — the contiguous block of "Key: value" lines at the very end, after the last blank line. The header line is never treated as a trailer, even for a single-line message that happens to contain a colon.

Types

type PRReference

type PRReference struct {
	Number int
	Link   string
}

PRReference is a pull/merge request number resolved directly from commit message text (see ADR-0001). Link is only populated when the text itself carried a full URL (Gitea/Forgejo's "Reviewed-on:" trailer) — GitHub's "(#N)" squash suffix carries no URL, so Link stays empty for that form; a canonical link for it comes from the live API lookup (ticket 08), not from guessing a URL out of thin air here.

func ExtractPRReference

func ExtractPRReference(message string) (PRReference, bool)

ExtractPRReference looks for a PR reference embedded directly in a commit's message text: GitHub squash-merge's "(#N)" title suffix, or Gitea/Forgejo squash-merge's "Reviewed-on: .../pulls/N" footer trailer. ok is false when neither form is present — callers attach no reference rather than guessing one (ADR-0001).

type ParsedCommit

type ParsedCommit struct {
	Type        string
	Scope       string
	Breaking    bool
	Description string
}

ParsedCommit is the structured form of a Conventional Commit header.

func Parse

func Parse(message string) (parsed ParsedCommit, ok bool)

Parse reads a commit message's header line as a Conventional Commit. ok is false when the header doesn't match the Conventional Commits grammar — callers drop such commits rather than guessing at their meaning (ADR-0003).

Jump to

Keyboard shortcuts

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