github

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package github provides a client for querying the GitHub API, primarily to check repository metadata such as archive status.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseGitHubRemote

func ParseGitHubRemote(url string) (owner, repo string, ok bool)

ParseGitHubRemote extracts owner and repo from a GitHub remote URL. Supports both SSH (git@github.com:owner/repo.git) and HTTPS (https://github.com/owner/repo.git) formats.

Types

type Client

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

Client wraps GitHub API access.

func NewClient

func NewClient(token string) *Client

NewClient creates a GitHub client. It attempts to use authentication from the gh CLI config, falling back to the provided token, falling back to unauthenticated access.

func (*Client) BranchPRInfo added in v0.6.0

func (c *Client) BranchPRInfo(owner, repo, branch string) (*PRInfo, error)

BranchPRInfo returns detailed PR information for a branch. When no PR exists, the returned PRInfo has State set to PRStateNone.

func (*Client) IsArchived

func (c *Client) IsArchived(owner, repo string) (bool, error)

IsArchived checks if a repository is archived on GitHub.

type PRInfo added in v0.6.0

type PRInfo struct {
	Number   int
	State    PRState
	MergedAt time.Time
	HeadSHA  string
}

PRInfo contains detailed information about a pull request for a branch.

type PRState added in v0.3.0

type PRState string

PRState represents the state of a GitHub pull request for a branch.

const (
	// PRStateNone means no PR was found for the branch.
	PRStateNone PRState = "none"
	// PRStateOpen means a PR is currently open.
	PRStateOpen PRState = "open"
	// PRStateMerged means the PR was merged.
	PRStateMerged PRState = "merged"
	// PRStateClosed means the PR was closed without merging.
	PRStateClosed PRState = "closed"
)

Jump to

Keyboard shortcuts

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