github

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeFetcher

type FakeFetcher struct {
	FetchFunc        func(ctx context.Context, repo string, ref string, destinationPath string) error
	GetCommitSHAFunc func(ctx context.Context, repo string, ref string) (string, error)
}

func (*FakeFetcher) Fetch

func (ff *FakeFetcher) Fetch(ctx context.Context, repo string, ref string, destinationPath string) error

func (*FakeFetcher) GetCommitSHA

func (ff *FakeFetcher) GetCommitSHA(ctx context.Context, repo string, ref string) (string, error)

type GitHubFetcher

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

GitHubFetcher represents a github data fetcher

func NewGitHubFetcher

func NewGitHubFetcher(token string) *GitHubFetcher

NewGitHubFetcher returns a new github fetcher

func (*GitHubFetcher) Fetch

func (gf *GitHubFetcher) Fetch(ctx context.Context, repo, ref, destinationPath string) error

Fetch fetches the content for repo at ref, writing the tree to destinationPath The destination will contain exactly one subdirectory with a pseudorandom name (generated by GitHub) based on the repo name. The contents of this subdirectory is the root of the repo and all content is underneath it. Example: [destinationPath]/foo-repo-name-12345/README.md (etc)

func (*GitHubFetcher) GetCommitSHA

func (gf *GitHubFetcher) GetCommitSHA(ctx context.Context, repo string, ref string) (csha string, err error)

GetCommitSHA returns the commit SHA for a reference

Jump to

Keyboard shortcuts

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