github

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepoNames

func GetRepoNames(repos []Repository) []string

GetRepoNames extracts repository names from a list of repos

Types

type Client

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

Client handles GitHub API operations

func NewClient

func NewClient(token, org string) *Client

NewClient creates a new GitHub API client

func (*Client) CreateRelease added in v0.19.3

func (c *Client) CreateRelease(owner, repo, tag, releaseNotes string) error

CreateRelease creates a release for the given tag on GitHub.

func (*Client) CreateRepo

func (c *Client) CreateRepo(repoName, description string, private bool) error

CreateRepo creates a new repository

func (*Client) DeleteRepo

func (c *Client) DeleteRepo(repoName string) error

DeleteRepo deletes a repository from GitHub

func (*Client) GetReleases added in v0.19.3

func (c *Client) GetReleases(owner, repo string) ([]string, error)

GetReleases fetches the tag names of existing releases for the repository. A 404 (repository missing on GitHub) is normalized to an empty result so the caller can treat it as "no releases yet" instead of an error. No token is required: when the client has no token the request is sent unauthenticated, which still lists releases for public repositories (matching GitHub's unauthenticated rate-limited access).

func (*Client) GetRepo added in v0.9.0

func (c *Client) GetRepo(repoName string) (Repository, bool, error)

GetRepo fetches a single repository by name Returns the repository, a boolean indicating existence, and an error

func (*Client) GetRepoDescription added in v0.18.3

func (c *Client) GetRepoDescription(repoName string) (string, bool, error)

GetRepoDescription fetches a repository description.

func (*Client) HasToken

func (c *Client) HasToken() bool

HasToken returns whether a token is configured

func (*Client) ListPublicRepos

func (c *Client) ListPublicRepos() ([]Repository, error)

ListPublicRepos lists all public repositories for the user/org

func (*Client) RepoExists

func (c *Client) RepoExists(repoName string) (bool, error)

RepoExists checks if a repository exists

func (*Client) UpdateRelease added in v0.19.3

func (c *Client) UpdateRelease(owner, repo, tag, releaseNotes string) error

UpdateRelease updates the body of an existing release for the given tag on GitHub.

func (*Client) UpdateRepoDescription added in v0.9.0

func (c *Client) UpdateRepoDescription(repoName, description string) error

UpdateRepoDescription updates the repository description

type CreateRepoRequest

type CreateRepoRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	AutoInit    bool   `json:"auto_init"`
}

CreateRepoRequest represents the request to create a repository

type CreateRepoResponse

type CreateRepoResponse struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	Private  bool   `json:"private"`
	SSHURL   string `json:"ssh_url"`
	CloneURL string `json:"clone_url"`
}

CreateRepoResponse represents the response from creating a repository

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Errors  []struct {
		Resource string `json:"resource"`
		Field    string `json:"field"`
		Code     string `json:"code"`
	} `json:"errors,omitempty"`
}

ErrorResponse represents an error response from GitHub API

type Release added in v0.19.3

type Release struct {
	TagName string `json:"tag_name"`
	Name    string `json:"name"`
	Body    string `json:"body"`
}

Release represents a GitHub release as returned by the releases API.

type Repository

type Repository struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	Fork        bool   `json:"fork"`
	Archived    bool   `json:"archived"`
	Disabled    bool   `json:"disabled"`
	Size        int    `json:"size"`
}

Repository represents a GitHub repository

Jump to

Keyboard shortcuts

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