gh2changelog

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 20 Imported by: 1

README

gh2changelog

Test Status MIT License PkgGoDev

gh2changelog generates keep a changelog like output from GitHub Releases

Synopsis

% gh2changelog
# Changelog

## [v0.0.14](https://github.com/Songmu/tagpr/compare/v0.0.13...v0.0.14) - 2022-08-28
- fix version file detection in releasing by @Songmu in https://github.com/Songmu/tagpr/pull/70
...

Description

The "gh2changelog" outputs a changelog of the "Keep a changelog" like format and writes it to CHANGELOG.md. To generate a changelog, it utilizes "generate-notes" in the GitHub REST API's Releases.

Options

  -all          outputs all changelogs
  -alone        only outputs the specified changelog without merging with CHANGELOG.md.
  -git string   git path (default "git")
  -latest       get latest changelog section
  -limit int    outputs the specified number of most recent changelogs
  -next string  tag to be released next
  -repo string  local repository path (default ".")
  -tag string   specify existing tag
  -unreleased   output unreleased
  -verbose      verbose
  -w            write result to CHANGELOG.md

GITHUB Token

GitHub's access token is used in the following order of priority.

  • enviroment variable GITHUB_TOKEN
  • read from gh cli configurations
  • git config github.token

Installation

# Install the latest version. (Install it into ./bin/ by default).
% curl -sfL https://raw.githubusercontent.com/Songmu/gh2changelog/main/install.sh | sh -s

# Specify installation directory ($(go env GOPATH)/bin/) and version.
% curl -sfL https://raw.githubusercontent.com/Songmu/gh2changelog/main/install.sh | sh -s -- -b $(go env GOPATH)/bin [vX.Y.Z]

# In alpine linux (as it does not come with curl by default)
% wget -O - -q https://raw.githubusercontent.com/Songmu/gh2changelog/main/install.sh | sh -s [vX.Y.Z]

# homebrew
% brew install Songmu/tap/gh2changelog

# go install
% go install github.com/Songmu/gh2changelog/cmd/gh2changelog@latest

# aqua https://aquaproj.github.io/
% aqua g -i Songmu/gh2changelog

Built binaries are available on gihub releases. https://github.com/Songmu/gh2changelog/releases

Author

Songmu

Documentation

Index

Constants

View Source
const (
	DryRun = 1 << iota
	Trunc
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, argv []string, outStream, errStream io.Writer) error

Run the gh2changelog

Types

type GH2Changelog

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

GH2Changelog is to output changelogs

func New

func New(ctx context.Context, opts ...Option) (*GH2Changelog, error)

New returns new GH2Changelog

func (*GH2Changelog) Changelog

func (gch *GH2Changelog) Changelog(ctx context.Context, tag string) (string, string, error)

Changelog gets changelog for specified tag

func (*GH2Changelog) Changelogs

func (gch *GH2Changelog) Changelogs(ctx context.Context, limit int) ([]string, []string, error)

Changelogs gets changelogs

func (*GH2Changelog) Draft

func (gch *GH2Changelog) Draft(ctx context.Context, nextTag string, releaseDate time.Time) (string, string, error)

Draft gets draft changelog

func (*GH2Changelog) Latest

func (gch *GH2Changelog) Latest(ctx context.Context) (string, string, error)

Latest gets latest changelog

func (*GH2Changelog) Unreleased

func (gch *GH2Changelog) Unreleased(ctx context.Context) (string, string, error)

Unreleased gets unreleased changelog

func (*GH2Changelog) Update

func (gch *GH2Changelog) Update(section string, mode int) (string, error)

Update CHANGELOG.md

type Option

type Option func(*GH2Changelog)

Options is for functional option

func GitHubClient

func GitHubClient(cli *github.Client) Option

GitHubClient sets a github.Client

func GitPath

func GitPath(p string) Option

GitPath sets a git executable path

func RepoPath

func RepoPath(p string) Option

RepoPath sets a repository path

func SetOutputs

func SetOutputs(outStream, errStream io.Writer) Option

SetOutputs sets a stdout and a stderr

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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