github

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 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) BranchPRState added in v0.3.0

func (c *Client) BranchPRState(owner, repo, branch string) (PRState, error)

BranchPRState returns the PR state for a branch. It checks the most recent PR associated with the given head branch. Returns PRStateNone if no PR exists for the branch.

func (*Client) IsArchived

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

IsArchived checks if a repository is archived on GitHub.

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