Documentation
¶
Index ¶
- Constants
- type Client
- type GitHub
- func (g *GitHub) Client() Client
- func (g *GitHub) CreatePullRequest(owner, repo, baseBranchName, headBranchName, title, body string) (*github.PullRequest, error)
- func (g *GitHub) DownloadReleaseAssets(owner, repo string, releaseTags []string, outputDir string) error
- func (g *GitHub) GetReleaseTags(owner, repo string, includePrereleases bool) ([]string, error)
- func (g *GitHub) GetRepository(owner, repo string) (*github.Repository, error)
- func (g *GitHub) LatestGitHubTagsPerBranch() (TagsPerBranch, error)
- func (g *GitHub) ListBranches(owner, repo string) ([]*github.Branch, error)
- func (g *GitHub) Releases(owner, repo string, includePrereleases bool) ([]*github.RepositoryRelease, error)
- func (g *GitHub) RepoIsForkOf(forkOwner, forkRepo, parentOwner, parentRepo string) (bool, error)
- func (g *GitHub) SetClient(client Client)
- type TagsPerBranch
Constants ¶
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 ¶
type Client interface { GetCommit( context.Context, string, string, string, ) (*github.Commit, *github.Response, error) GetPullRequest( context.Context, string, string, int, ) (*github.PullRequest, *github.Response, error) GetRepoCommit( context.Context, string, string, string, ) (*github.RepositoryCommit, *github.Response, error) ListCommits( context.Context, string, string, *github.CommitsListOptions, ) ([]*github.RepositoryCommit, *github.Response, error) ListPullRequestsWithCommit( context.Context, string, string, string, *github.PullRequestListOptions, ) ([]*github.PullRequest, *github.Response, error) ListReleases( context.Context, string, string, *github.ListOptions, ) ([]*github.RepositoryRelease, *github.Response, error) GetReleaseByTag( context.Context, string, string, string, ) (*github.RepositoryRelease, *github.Response, error) DownloadReleaseAsset( context.Context, string, string, int64, ) (io.ReadCloser, string, error) ListTags( context.Context, string, string, *github.ListOptions, ) ([]*github.RepositoryTag, *github.Response, error) ListBranches( context.Context, string, string, *github.BranchListOptions, ) ([]*github.Branch, *github.Response, error) CreatePullRequest( context.Context, string, string, string, string, string, string, ) (*github.PullRequest, error) GetRepository( context.Context, string, string, ) (*github.Repository, *github.Response, error) }
func NewRecorder ¶ added in v0.2.7
func NewReplayer ¶ added in v0.2.7
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
NewWithToken can be used to specify a GITHUB_TOKEN before retrieving the client to enforce authenticated GitHub requests
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
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
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
RepoIsForkOf Function that checks if a repository is a fork of another
type TagsPerBranch ¶
TagsPerBranch is an abstraction over a simple branch to latest tag association