github

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenEnvKey is the default GitHub token environemt variable key
	TokenEnvKey = "GITHUB_TOKEN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

func NewRecorder added in v0.2.7

func NewRecorder(c Client, recordDir string) Client

func NewReplayer added in v0.2.7

func NewReplayer(replayDir string) Client

type GitHub

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

GitHub is a wrapper around GitHub related functionality

func New

func New() *GitHub

New creates a new default GitHub client. Tokens set via the $GITHUB_TOKEN environment variable will result in an authenticated client. If the $GITHUB_TOKEN is not set, then the client will do unauthenticated GitHub requests.

func NewWithToken added in v0.2.7

func NewWithToken(token string) (*GitHub, error)

NewWithToken can be used to specify a GITHUB_TOKEN before retrieving the client to enforce authenticated GitHub requests

func (*GitHub) Client added in v0.2.7

func (g *GitHub) Client() Client

Client can be used to retrieve the Client type

func (*GitHub) CreatePullRequest added in v0.3.1

func (g *GitHub) CreatePullRequest(
	owner, repo, baseBranchName, headBranchName, title, body string,
) (*github.PullRequest, error)

CreatePullRequest Creates a new pull request in owner/repo:baseBranch to merge changes from headBranchName which is a string containing a branch in the same repository or a user:branch pair

func (*GitHub) DownloadReleaseAssets added in v0.3.3

func (g *GitHub) DownloadReleaseAssets(owner, repo string, releaseTags []string, outputDir string) error

DownloadReleaseAssets downloads a set of GitHub release assets to an `outputDir`. Assets to download are derived from the `releaseTags`.

func (*GitHub) GetReleaseTags added in v0.3.3

func (g *GitHub) GetReleaseTags(owner, repo string, includePrereleases bool) ([]string, error)

GetReleaseTags returns a list of GitHub release tags for the provided `owner` and `repo`. If `includePrereleases` is `true`, then the resulting slice will also contain pre/drafted releases.

func (*GitHub) GetRepository added in v0.3.2

func (g *GitHub) GetRepository(
	owner, repo string,
) (*github.Repository, error)

GetRepository gets a repository using the current client

func (*GitHub) LatestGitHubTagsPerBranch

func (g *GitHub) LatestGitHubTagsPerBranch() (TagsPerBranch, error)

LatestGitHubTagsPerBranch returns the latest GitHub available tag for each branch. The logic how releases are associates with branches is motivated by the changelog generation and bound to the default Kubernetes release strategy, which is also the reason why we do not provide a repo and org parameter here.

Releases are associated in the following way: - x.y.0-alpha.z releases are only associated with the master branch - x.y.0-beta.z releases are only associated with their release-x.y branch - x.y.0 final releases are associated with the master and the release-x.y branch

func (*GitHub) ListBranches added in v0.3.3

func (g *GitHub) ListBranches(
	owner, repo string,
) ([]*github.Branch, error)

ListBranches gets a repository using the current client

func (*GitHub) Releases

func (g *GitHub) Releases(owner, repo string, includePrereleases bool) ([]*github.RepositoryRelease, error)

Releases returns a list of GitHub releases for the provided `owner` and `repo`. If `includePrereleases` is `true`, then the resulting slice will also contain pre/drafted releases. TODO: Create a more descriptive method name and update references

func (*GitHub) RepoIsForkOf added in v0.3.2

func (g *GitHub) RepoIsForkOf(
	forkOwner, forkRepo, parentOwner, parentRepo string,
) (bool, error)

RepoIsForkOf Function that checks if a repository is a fork of another

func (*GitHub) SetClient

func (g *GitHub) SetClient(client Client)

SetClient can be used to manually set the internal GitHub client

type TagsPerBranch

type TagsPerBranch map[string]string

TagsPerBranch is an abstraction over a simple branch to latest tag association

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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