github

package
v0.0.0-...-ccc4ed2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitSshProtocolType   = "ssh"
	GitHttpsProtocolType = "https"
)

Variables

View Source
var (
	ErrGitHubCliNotLoggedIn = errors.New("gh cli is not logged in")
	ErrUserNotAuthorized    = errors.New("user is not authorized. " +
		"Try running gh auth refresh with the required scopes to request additional authorization")
	ErrRepositoryNameInUse = errors.New("repository name already in use")

	// The hostname of the public GitHub service.
	GitHubHostName = "github.com"

	// Environment variable that gh cli uses for auth token overrides
	TokenEnvVars = []string{"GITHUB_TOKEN", "GH_TOKEN"}
)
View Source
var GitHubCliVersion semver.Version = semver.MustParse("2.28.0")

GitHubCliVersion is the minimum version of GitHub cli that we require (and the one we fetch when we fetch bicep on behalf of a user).

Functions

func RunningOnCodespaces

func RunningOnCodespaces() bool

RunningOnCodespaces check if the application is running on codespaces.

Types

type AuthStatus

type AuthStatus struct {
	LoggedIn bool
}

The result from calling GetAuthStatus

type GhCliRepository

type GhCliRepository struct {
	// The slug for a repository (formatted as "<owner>/<name>")
	NameWithOwner string
	// The Url for the HTTPS endpoint for the repository
	HttpsUrl string `json:"url"`
	// The Url for the SSH endpoint for the repository
	SshUrl string
}

type GitHubActionsResponse

type GitHubActionsResponse struct {
	TotalCount int `json:"total_count"`
}

type GitHubCli

type GitHubCli interface {
	tools.ExternalTool
	GetAuthStatus(ctx context.Context, hostname string) (AuthStatus, error)
	ListSecrets(ctx context.Context, repo string) ([]string, error)
	ListVariables(ctx context.Context, repo string) ([]string, error)
	SetSecret(ctx context.Context, repo string, name string, value string) error
	DeleteSecret(ctx context.Context, repo string, name string) error
	SetVariable(ctx context.Context, repoSlug string, name string, value string) error
	DeleteVariable(ctx context.Context, repoSlug string, name string) error
	Login(ctx context.Context, hostname string) error
	ListRepositories(ctx context.Context) ([]GhCliRepository, error)
	ViewRepository(ctx context.Context, name string) (GhCliRepository, error)
	CreatePrivateRepository(ctx context.Context, name string) error
	GetGitProtocolType(ctx context.Context) (string, error)
	GitHubActionsExists(ctx context.Context, repoSlug string) (bool, error)
	BinaryPath() string
}

func NewGitHubCli

func NewGitHubCli(ctx context.Context, console input.Console, commandRunner exec.CommandRunner) (GitHubCli, error)

Jump to

Keyboard shortcuts

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