github

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPullRequestFound = errors.New("no pull request found")
	ErrRepoExists         = errors.New("repository already exists")
)

Functions

func GHLogin

func GHLogin(hostname string) (string, error)

func GetGitHubToken

func GetGitHubToken(cfg config.Containable) (string, error)

GetGitHubToken returns the GitHub token from config, erroring when none is available. Use this where a token is strictly required (e.g. git operations). For release/update operations on public repos, prefer vcs.ResolveToken directly.

func NewReleaseProvider

func NewReleaseProvider(client GitHubClient) release.Provider

Types

type GHClient

type GHClient struct {
	Client *github.Client
	// contains filtered or unexported fields
}

func NewGitHubClient

func NewGitHubClient(cfg config.Containable) (*GHClient, error)

func (*GHClient) AddLabelsToPullRequest

func (c *GHClient) AddLabelsToPullRequest(ctx context.Context, owner, repo string, number int, labels []string) error

func (*GHClient) CreatePullRequest

func (c *GHClient) CreatePullRequest(ctx context.Context, owner string, repo string, pr *github.NewPullRequest) (*github.PullRequest, error)

func (*GHClient) CreateRepo

func (c *GHClient) CreateRepo(ctx context.Context, owner, slug string) (*github.Repository, error)

func (*GHClient) DownloadAsset

func (c *GHClient) DownloadAsset(ctx context.Context, owner, repo string, assetID int64) (io.ReadCloser, error)

func (*GHClient) DownloadAssetTo

func (c *GHClient) DownloadAssetTo(ctx context.Context, fs afero.Fs, owner, repo string, assetID int64, filePath string) error

func (*GHClient) GetClient

func (c *GHClient) GetClient() *github.Client

func (*GHClient) GetFileContents

func (c *GHClient) GetFileContents(ctx context.Context, owner, repo, path, ref string) (string, error)

func (*GHClient) GetPullRequestByBranch

func (c *GHClient) GetPullRequestByBranch(ctx context.Context, owner, repo, branch, state string) (*github.PullRequest, error)

func (*GHClient) GetReleaseAssetID

func (c *GHClient) GetReleaseAssetID(ctx context.Context, owner, repo, tag, assetName string) (int64, error)

func (*GHClient) GetReleaseAssets

func (c *GHClient) GetReleaseAssets(ctx context.Context, owner, repo, tag string) ([]*github.ReleaseAsset, error)

func (*GHClient) ListReleases

func (c *GHClient) ListReleases(ctx context.Context, owner, repo string) ([]string, error)

func (*GHClient) UpdatePullRequest

func (c *GHClient) UpdatePullRequest(ctx context.Context, owner, repo string, number int, pr *github.PullRequest) (*github.PullRequest, *github.Response, error)

func (*GHClient) UploadKey

func (c *GHClient) UploadKey(ctx context.Context, name string, key []byte) error

type GitHubClient

type GitHubClient interface {
	GetClient() *github.Client
	CreatePullRequest(ctx context.Context, owner string, repo string, pull *github.NewPullRequest) (*github.PullRequest, error)
	GetPullRequestByBranch(ctx context.Context, owner, repo, branch, state string) (*github.PullRequest, error)
	AddLabelsToPullRequest(ctx context.Context, owner, repo string, number int, labels []string) error
	UpdatePullRequest(ctx context.Context, owner, repo string, number int, pull *github.PullRequest) (*github.PullRequest, *github.Response, error)
	CreateRepo(ctx context.Context, owner, slug string) (*github.Repository, error)
	UploadKey(ctx context.Context, name string, key []byte) error
	ListReleases(ctx context.Context, owner, repo string) ([]string, error)
	GetReleaseAssets(ctx context.Context, owner, repo, tag string) ([]*github.ReleaseAsset, error)
	GetReleaseAssetID(ctx context.Context, owner, repo, tag, assetName string) (int64, error)
	DownloadAsset(ctx context.Context, owner, repo string, assetID int64) (io.ReadCloser, error)
	DownloadAssetTo(ctx context.Context, fs afero.Fs, owner, repo string, assetID int64, filePath string) error
	GetFileContents(ctx context.Context, owner, repo, path, ref string) (string, error)
}

type GitHubReleaseProvider

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

GitHubReleaseProvider implements release.Provider.

func (*GitHubReleaseProvider) DownloadReleaseAsset

func (p *GitHubReleaseProvider) DownloadReleaseAsset(ctx context.Context, owner, repo string, asset release.ReleaseAsset) (io.ReadCloser, string, error)

func (*GitHubReleaseProvider) GetLatestRelease

func (p *GitHubReleaseProvider) GetLatestRelease(ctx context.Context, owner, repo string) (release.Release, error)

func (*GitHubReleaseProvider) GetReleaseByTag

func (p *GitHubReleaseProvider) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (release.Release, error)

func (*GitHubReleaseProvider) ListReleases

func (p *GitHubReleaseProvider) ListReleases(ctx context.Context, owner, repo string, limit int) ([]release.Release, error)

Jump to

Keyboard shortcuts

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