changelog

package
v0.0.0-...-380e484 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotationToTemplate

func AnnotationToTemplate(annotation Annotation) ([]byte, error)

AnnotationToTemplate returns a Change template populated with the given Change's data.

func RemoveAnnotation

func RemoveAnnotation(path string, annotation Annotation) (err error)

RemoveAnnotation removes the annotation from the changelog metadata directory.

func Validate

func Validate(annotation Annotation) error

Validate returns an error if annotation does not mean the minimum requirements.

func WriteAnnotation

func WriteAnnotation(path string, annotation Annotation) (err error)

WriteAnnotation writes the annotation to changelog metadata directory. Path should be the location of the repository root.

Types

type Annotation

type Annotation struct {
	// The unique identifier for this Annotation.
	ID string `json:"id" toml:"id" comment:"Annotation Identifier (DO NOT CHANGE)"`

	// Indicates what category of Annotation was made. For example "feature" or "bugfix".
	Type ChangeType `json:"type" toml:"type" comment:"Valid Types: announcement, release, feature, bugfix, documentation, or dependency"`

	// Collapse indicates that the change description should collapsed into a single item when summarizing changes across modules
	Collapse bool `json:"collapse,omitempty" toml:"collapse" comment:"annotation should collapse as a summary in the CHANGELOG"`

	// A human readable description of this Annotation meant to be included in a CHANGELOG.
	Description string `json:"description" toml:"description" comment:"single-line string or markdown list"`

	// The modules this change applies to
	Modules []string `json:"modules"  toml:"modules" comment:"one or more relative module paths"`
}

Annotation represents a change to one or more Go modules.

func GetAnnotations

func GetAnnotations(path string) (annotations []Annotation, err error)

GetAnnotations returns the list of annotations that are currently present. Path should be the location of the repository root.

func LoadAnnotation

func LoadAnnotation(path string, id string) (a Annotation, err error)

LoadAnnotation loads the annotation id for the given repository path.

func LoadAnnotationFile

func LoadAnnotationFile(path string) (a Annotation, err error)

LoadAnnotationFile loads the annotation file at the given path.

func NewAnnotation

func NewAnnotation() (Annotation, error)

NewAnnotation creates a new annotation with a populated identifier.

func TemplateToAnnotation

func TemplateToAnnotation(filledTemplate []byte) (annotation Annotation, err error)

TemplateToAnnotation parses the provided filledTemplate into the provided Change. If Change has no ID, TemplateToChange will set the ID.

type ChangeType

type ChangeType int

ChangeType describes the type of change made to a Go module.

const (
	UnknownChangeType ChangeType = iota
	// DependencyChangeType is a constant change type for a dependency update.
	DependencyChangeType
	// DocumentationChangeType is a constant change type for an SDK announcement.
	DocumentationChangeType
	// BugFixChangeType is a constant change type for a bug fix.
	BugFixChangeType
	// FeatureChangeType is a constant change type for a new feature.
	FeatureChangeType
	// ReleaseChangeType is a constant change type for a major version updates (from v0 => v1).
	ReleaseChangeType
	// AnnouncementChangeType is a constant change type for an SDK announcement.
	AnnouncementChangeType
)

ChangeType in order from least to most precedence when generating changelog summaries

func ParseChangeType

func ParseChangeType(v string) ChangeType

ParseChangeType attempts to parse the given string v into a ChangeType, returning an error if the string is invalid.

func (ChangeType) ChangelogPrefix

func (c ChangeType) ChangelogPrefix() string

ChangelogPrefix returns the CHANGELOG header the ChangeType should be grouped under.

func (ChangeType) MarshalJSON

func (c ChangeType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ChangeType to a JSON string representation.

func (ChangeType) MarshalTOML

func (c ChangeType) MarshalTOML() ([]byte, error)

MarshalTOML marshals the ChangeType to a TOML string representation.

func (ChangeType) String

func (c ChangeType) String() string

String returns a string representation of the ChangeType

func (*ChangeType) UnmarshalJSON

func (c *ChangeType) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshal bytes, which must be a string, to it's ChangeType representaiton.

func (*ChangeType) UnmarshalTOML

func (c *ChangeType) UnmarshalTOML(i interface{}) error

UnmarshalTOML unmarshal i, which must be a string, to it's ChangeType representaiton.

func (ChangeType) VersionIncrement

func (c ChangeType) VersionIncrement() SemVerIncrement

VersionIncrement returns the SemVerIncrement corresponding to the given ChangeType.

type SemVerIncrement

type SemVerIncrement int

SemVerIncrement describes how a Annotation should affect a module's version.

const (
	// DefaultBump indicates the the module's version should be incremented using the version selectors default behavior.
	DefaultBump SemVerIncrement = iota

	// PatchBump indicates the module's version should be incremented by a patch version bump.
	PatchBump
	// MinorBump indicates the module's version should be incremented by a minor version bump.
	MinorBump
	// ReleaseBump indicates the module version should be updated from a pre-release tag.
	ReleaseBump
)

func GetVersionIncrement

func GetVersionIncrement(annotations []Annotation) (v SemVerIncrement)

GetVersionIncrement returns the highest version increment from a set of annotations.

type ValidationError

type ValidationError struct {
	Issues []string
}

ValidationError is an error that indicates that one ore more issues are present for an annotation.

func (*ValidationError) Error

func (v *ValidationError) Error() string

Error returns the error string

Jump to

Keyboard shortcuts

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