options

package
v0.17.10 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RevisionDiscoveryModeNONE              = "none"
	RevisionDiscoveryModeMergeBaseToLatest = "mergebase-to-latest"
	RevisionDiscoveryModePatchToPatch      = "patch-to-patch"
	RevisionDiscoveryModePatchToLatest     = "patch-to-latest"
	RevisionDiscoveryModeMinorToMinor      = "minor-to-minor"
)
View Source
const (
	FormatJSON     = "json"
	FormatMarkdown = "markdown"

	GoTemplatePrefix       = "go-template:"
	GoTemplatePrefixInline = "inline:"
	GoTemplateDefault      = GoTemplatePrefix + "default"
	GoTemplateInline       = GoTemplatePrefix + GoTemplatePrefixInline
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// GithubBaseURL specifies the Github base URL.
	GithubBaseURL string

	// GithubUploadURL specifies the Github upload URL.
	GithubUploadURL string

	// GithubOrg specifies the GitHub organization from which will be
	// cloned/pulled if Pull is true.
	GithubOrg string

	// GithubRepo specifies the GitHub repository from which will be
	// cloned/pulled if Pull is true.
	GithubRepo string

	// RepoPath specifies the git repository location for doing an update if
	// Pull is true.
	RepoPath string

	// Branch will be used for discovering the latest patch version if
	// DiscoverMode is RevisionDiscoveryModePatchToPatch.
	Branch string

	// StartSHA can be used to set the release notes start revision to an
	// exact git SHA. Should not be used together with StartRev.
	StartSHA string

	// EndSHA can be used to set the release notes end revision to an
	// exact git SHA. Should not be used together with EndRev.
	EndSHA string

	// StartRev can be used to set the release notes start revision to any
	// valid git revision. Should not be used together with StartSHA.
	StartRev string

	// EndRev can be used to set the release notes end revision to any
	// valid git revision. Should not be used together with EndSHA.
	EndRev string

	// SkipFirstCommit skips the first commit if StartRev is being used. This
	// is useful if StartRev is a tag which should not be included in the
	// release notes.
	SkipFirstCommit bool

	// Format specifies the format of the release notes. Can be either
	// `json` or `markdown`.
	Format string

	// If the `Format` is `markdown`, then this specifies the selected go
	// template. Can be `go-template:default`, `go-template:<file.template>` or
	// `go-template:inline:<template>`.
	GoTemplate string

	// RequiredAuthor can be used to filter the release notes by the commit
	// author
	RequiredAuthor string

	// DiscoverMode can be used to automatically discover StartSHA and EndSHA.
	// Can be either RevisionDiscoveryModeNONE (default),
	// RevisionDiscoveryModeMergeBaseToLatest,
	// RevisionDiscoveryModePatchToPatch, or RevisionDiscoveryModeMinorToMinor.
	// Should not be used together with StartRev, EndRev, StartSHA or EndSHA.
	DiscoverMode string

	// ReleaseTars specifies the directory where the release tarballs are
	// located.
	ReleaseTars string

	// ReleaseBucket specifies the Google Cloud bucket where the ReleaseTars
	// are linked to. This option is used for generating the links inside the
	// release downloads table.
	ReleaseBucket string

	// If true, then the release notes generator will pull in latest changes
	// from the default git remote
	Pull bool

	// If true, then the release notes generator will print messages in debug
	// log level
	Debug bool

	// EXPERIMENTAL: Feature flag for using v2 implementation to list commits
	ListReleaseNotesV2 bool

	// RecordDir specifies the directory for API call recordings. Cannot be
	// used together with ReplayDir.
	RecordDir string

	// ReplayDir specifies the directory for replaying a previously recorded
	// API. Cannot be used together with RecordDir.
	ReplayDir string

	// MapProviders list of release notes map providers to query during generations
	MapProviderStrings []string

	// If true, links for PRs and authors are added in the markdown format.
	// This is useful when the release notes are outputted to a file. When using the GitHub release page to publish release notes,
	// this option should be set to false to take advantage of Github's autolinked references.
	AddMarkdownLinks bool
	// contains filtered or unexported fields
}

Options is the global options structure which can be used to build release notes generator options.

func New

func New() *Options

New creates a new Options instance with the default values.

func (*Options) Client

func (o *Options) Client() (github.Client, error)

Client returns a Client to be used by the Gatherer. Depending on the provided options this is either a real client talking to the GitHub API, a Client which in addition records the responses from Github and stores them on disk, or a Client that replays those pre-recorded responses and does not talk to the GitHub API at all.

func (*Options) ValidateAndFinish

func (o *Options) ValidateAndFinish() (err error)

ValidateAndFinish checks if the options are set in a consistent way and adapts them if necessary. It returns an error if options are set to invalid values.

type RevisionDiscoveryMode

type RevisionDiscoveryMode string

Jump to

Keyboard shortcuts

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