ghcl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package ghcl provides functionality for generating a changelog entry from GitHub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(cs ChangelogService) error

Build fetches a list of changelog entries using the given changelog service, and prints them to stdout.

func FormatChangelogEntries

func FormatChangelogEntries(entries []*ChangelogEntry) string

FormatChangelogEntries formats a slice of changelog entries, returning a string that can be used to display them.

Types

type ChangelogEntry

type ChangelogEntry struct {
	Number   int
	Body     string
	Username string
	MergedAt time.Time
}

A ChangelogEntry contains the data used to display changelog entries and sort them.

func FetchChangelogEntries

func FetchChangelogEntries(cs ChangelogService) ([]*ChangelogEntry, error)

FetchChangelogEntries fetches a list of all changelog entries using the given changelog service.

type ChangelogService

type ChangelogService interface {
	FetchReleaseTime() (time.Time, error)
	FetchChangelogEntriesUntil(t time.Time) ([]*ChangelogEntry, error)
}

A ChangelogService implements the methods required to build a changelog.

type GitHubChangelogService

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

A GitHubChangelogService implements the ChangelogService for public GitHub.

func NewGitHubChangelogService

func NewGitHubChangelogService(organization, repository, token, apiURL string) *GitHubChangelogService

NewGitHubChangelogService returns a new instance of a GitHubChangelogService.

The apiURL can be used to specify a different URL to access the GitHub API, typically used for GitHub enterprise customers.

func (*GitHubChangelogService) FetchChangelogEntriesUntil

func (gh *GitHubChangelogService) FetchChangelogEntriesUntil(t time.Time) ([]*ChangelogEntry, error)

FetchChangelogEntriesUntil fetches all of the pull requests merged before the given time.

func (*GitHubChangelogService) FetchReleaseTime

func (gh *GitHubChangelogService) FetchReleaseTime() (time.Time, error)

FetchReleaseTime fetches the time of the latest release on GitHub.

Jump to

Keyboard shortcuts

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