githubutil

package
v0.0.0-...-687c45b Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubOwnerBufbuild GithubOwner = "bufbuild"
	GithubRepoModules   GithubRepo  = "modules"
)

Variables

View Source
var ErrNotFound = errors.New("release not found")

Functions

This section is empty.

Types

type Client

type Client struct {
	GitHub *github.Client
}

func NewClient

func NewClient(ctx context.Context) *Client

NewClient returns a new HTTP client which can be used to perform actions on GitHub releases.

func (*Client) AllReleaseTagNames

func (c *Client) AllReleaseTagNames(
	ctx context.Context,
	owner string,
	repository string,
) ([]string, error)

AllReleaseTagNames gets all release tag names for the repository.

func (*Client) CreateRelease

func (c *Client) CreateRelease(
	ctx context.Context,
	owner GithubOwner,
	repo GithubRepo,
	release *github.RepositoryRelease,
) (*github.RepositoryRelease, error)

CreateRelease creates a new GitHub release under the owner and repo.

func (*Client) DownloadReleaseState

func (c *Client) DownloadReleaseState(
	ctx context.Context,
	release *github.RepositoryRelease,
) (*statev1alpha1.GlobalState, error)

DownloadReleaseState loads the state.json file from the specified GitHub release.

func (*Client) EditRelease

func (c *Client) EditRelease(
	ctx context.Context,
	owner GithubOwner,
	repo GithubRepo,
	releaseID int64,
	releaseChanges *github.RepositoryRelease,
) (*github.RepositoryRelease, error)

EditRelease performs an update of editable properties of a release (i.e. marking it not as a draft).

func (*Client) GetLatestRelease

func (c *Client) GetLatestRelease(
	ctx context.Context,
	owner GithubOwner,
	repo GithubRepo,
) (*github.RepositoryRelease, error)

GetLatestRelease returns information about the latest GitHub release for the given org and repo (i.e. 'bufbuild', 'modules'). If no release is found, returns ErrReleaseNotFound.

func (*Client) GetReleaseByTag

func (c *Client) GetReleaseByTag(
	ctx context.Context,
	owner GithubOwner,
	repo GithubRepo,
	tag string,
) (*github.RepositoryRelease, error)

GetReleaseByTag returns information about a given release (by tag name).

func (*Client) UploadReleaseAsset

func (c *Client) UploadReleaseAsset(
	ctx context.Context,
	owner GithubOwner,
	repo GithubRepo,
	releaseID int64,
	filename string,
) error

UploadReleaseAsset uploads the specified file to the release.

type GithubOwner

type GithubOwner string

type GithubRepo

type GithubRepo string

Jump to

Keyboard shortcuts

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