v1.35.3 Latest Latest

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 13 Imported by: 0



Package github provides utilities for interacting with GitHub repositories.



This section is empty.


View Source
var ErrEmptyTree = errors.New("empty tree")


func ExtractTree

func ExtractTree(ctx context.Context, tree *Tree, dst string) error

ExtractTree downloads a (sub-)tree from a GitHub repository and writes it to dst.


type Tree

type Tree struct {
	Owner  string // GitHub owner (user or organization)
	Repo   string // repository name
	Branch string // branch name
	Path   string // path to subtree ("." for whole project)

Tree contains information about a (sub-)tree in a GitHub repository.

func ParseTree

func ParseTree(ctx context.Context, s string) (*Tree, error)

ParseTree parses a GitHub repository URL into a Tree.

Valid URLs are: - -<branch> -<branch>/<path>

If the URL does not contain a branch, the default branch is queried using GitHub's API.

func (*Tree) Name

func (t *Tree) Name() string

Name reports a suitable name of the top-level directory in the tree. It defaults to the repository name, unless a Path is given in which case it is the last component of the path.

Jump to

Keyboard shortcuts

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