github

package
v0.0.0-...-21520da Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package github ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment struct {
	// Token to use for authenticating requests with the GitHub API
	Token string

	// API defines the URL for querying the GitHub API about
	// the identified repository
	API string

	// Owner contains the owner of the identified repository
	Owner string

	// Repository contains the name of the identified repository
	Repository string
}

Environment provides a snapshot of the current GitHub environment

func Env

func Env() (Environment, error)

Env attempts tp resolve the current GitHub environment by checking for expected environment variables. These environment variables are required for querying GitHub about the current repository

func (Environment) Resource

func (e Environment) Resource(uri string) string

Resource provides a helper for dynamically constructing a GitHub API URL for an identified repository URI, based on the current environment

type ErrEnvVarNotSet

type ErrEnvVarNotSet struct {
	Name string
}

ErrEnvVarNotSet is raised when an expected environment variable is not set

func (ErrEnvVarNotSet) Error

func (e ErrEnvVarNotSet) Error() string

Error returns a formatted message of the current error

type ErrNoRelease

type ErrNoRelease struct {
	Err error
}

ErrNoRelease is raised when no release exists within the target repository

func (ErrNoRelease) Error

func (e ErrNoRelease) Error() string

Error returns a formatted message of the current error

func (ErrNoRelease) Unwrap

func (e ErrNoRelease) Unwrap() error

Unwrap returns the inner most error

type ErrNoRepository

type ErrNoRepository struct {
	Err error
}

ErrNoRepository is raised when the target repository does not exist

func (ErrNoRepository) Error

func (e ErrNoRepository) Error() string

Error returns a formatted message of the current error

func (ErrNoRepository) Unwrap

func (e ErrNoRepository) Unwrap() error

Unwrap returns the inner most error

type RepositoryDetails

type RepositoryDetails struct {
	// Name of the repository
	Name string

	// Owner of the repository
	Owner string

	// URL of the repository
	URL string

	// Description of the repository
	Description string

	// License associated with the repository
	License string

	// Version of the latest release
	Version string

	// Artefacts associated with the latest release
	Artefacts []string
}

RepositoryDetails provides details about a repository within GitHub

func Repository

func Repository(env Environment) (RepositoryDetails, error)

Repository queries the GitHub API for details about the current repository identified within the environment

Jump to

Keyboard shortcuts

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