github

package
v0.0.0-...-3f15f89 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Package github provides a github-based lookup type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEmptyListETag

func SetEmptyListETag(accessToken string)

SetEmptyListETag finds the ETag for an empty list query on the GitHub API and sets it to be used as the initial ETag for Data.

Types

type Data

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

Data contains the information used and retrieved during GitHub requests, including the eTag, associated releases, and the usage state of the "/tags" endpoint.

func (*Data) Copy

func (g *Data) Copy() *Data

Copy will return a copy of the ETag, and Releases for the Data.

func (*Data) CopyFrom

func (g *Data) CopyFrom(from *Data)

CopyFrom copies the ETag and Releases from the given Data to the provider.

func (*Data) ETag

func (g *Data) ETag() string

ETag value of the Data.

func (*Data) Releases

func (g *Data) Releases() []github_types.Release

Releases stored in the Data.

func (*Data) SetETag

func (g *Data) SetETag(etag string)

SetETag of the Data.

func (*Data) SetReleases

func (g *Data) SetReleases(releases []github_types.Release)

SetReleases of the Data.

func (*Data) SetTagFallback

func (g *Data) SetTagFallback()

SetTagFallback will flip the TagFallback bool.

func (*Data) String

func (g *Data) String() string

String returns a string representation of the Status.

func (*Data) TagFallback

func (g *Data) TagFallback() bool

TagFallback value of the Data.

type Lookup

type Lookup struct {
	base.Lookup `yaml:",inline" json:",inline"` // Base struct for a Lookup.

	AccessToken   string `yaml:"access_token,omitempty" json:"access_token,omitempty"`     // GitHub access token to use.
	UsePreRelease *bool  `yaml:"use_prerelease,omitempty" json:"use_prerelease,omitempty"` // Whether releases with the prerelease tag should be considered.
	// contains filtered or unexported fields
}

Lookup provides a GitHub-based lookup type.

func New

func New(
	configFormat string,
	configData interface{},
	options *opt.Options,
	status *status.Status,
	defaults, hardDefaults *base.Defaults,
) (*Lookup, error)

New returns a new Lookup from a string in a given format (json/yaml).

func (*Lookup) CheckValues

func (l *Lookup) CheckValues(prefix string) error

CheckValues validates the fields of the Lookup struct.

func (*Lookup) GetGitHubData

func (l *Lookup) GetGitHubData() *Data

GetGitHubData will return the GitHub data. (For tests).

func (*Lookup) Inherit

func (l *Lookup) Inherit(fromLookup base.Interface)

Inherit values from `fromLookup` if the values should query the same source.

Values: githubData, Require.

func (*Lookup) Init

func (l *Lookup) Init(
	options *opt.Options,
	status *status.Status,
	defaults, hardDefaults *base.Defaults,
)

Init the Lookup, assigning Defaults, and initialising child structs.

func (*Lookup) Query

func (l *Lookup) Query(metrics bool, logFrom logutil.LogFrom) (bool, error)

Query queries the source, and returns whether a new release was found, and updates LatestVersion if so.

Parameters:

  • metrics: if true, set Prometheus metrics based on the query.

func (*Lookup) ServiceURL

func (l *Lookup) ServiceURL(ignoreWebURL bool) (serviceURL string)

ServiceURL translates possible `owner/repo` URLs, adding the github.com/ prefix.

func (*Lookup) UnmarshalJSON

func (l *Lookup) UnmarshalJSON(data []byte) error

UnmarshalJSON will unmarshal the Lookup.

func (*Lookup) UnmarshalYAML

func (l *Lookup) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML will unmarshal the Lookup.

Directories

Path Synopsis
Package types provides types for the GitHub API.
Package types provides types for the GitHub API.

Jump to

Keyboard shortcuts

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