github

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirPath

func DirPath(rawURL string) string

DirPath extracts the repo-relative directory path from a raw GitHub URL. For "https://raw.githubusercontent.com/owner/repo/refs/heads/main/apps/iam/kinds/manifest.cue" it returns "apps/iam/kinds".

func FetchDirectory

func FetchDirectory(ctx context.Context, repo RepoDescriptor, dirPath string, suffix string) (map[string][]byte, error)

FetchDirectory fetches all files with the given extension in a repository directory via the GitHub Contents API. Returns a map of filename → file content.

Types

type RepoDescriptor

type RepoDescriptor struct {
	Owner string
	Name  string
	Ref   string
}

RepoDescriptor describes a repository.

func RawURLToRepoDescriptor

func RawURLToRepoDescriptor(rawURL string) *RepoDescriptor

RawURLToRepoDescriptor extracts owner, repo, and ref from a raw GitHub URL. Handles both "refs/heads/main" and bare branch names.

func URLToRepoDescriptor

func URLToRepoDescriptor(repoUrl string, ref string) *RepoDescriptor

URLToRepoDescriptor extracts owner and repo from a GitHub URL.

Jump to

Keyboard shortcuts

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