gh

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GHlistInstallations     = listInstallations
	GHlistAppsInstalledRepo = listAppsInstalledRepo
	GHNewClientGitHubApps   = NewClientGitHubApps
)

function pointers (for testing)

View Source
var (
	// ErrNotFound is error for not found
	ErrNotFound = fmt.Errorf("not found")
)

Functions

func CheckSignature

func CheckSignature(installationID int64) error

CheckSignature check trust installation id from event.

func DivideScope added in v1.6.1

func DivideScope(scope string) (string, string)

DivideScope divide scope to owner and repo

func ExistGitHubRepository

func ExistGitHubRepository(scope, gheDomain string, githubPersonalToken string) error

ExistGitHubRepository check exist of GitHub repository

func ExistGitHubRunner added in v1.9.2

func ExistGitHubRunner(ctx context.Context, client *github.Client, owner, repo, runnerName string) (*github.Runner, error)

ExistGitHubRunner check exist registered of GitHub runner

func GenerateGitHubAppsToken added in v1.7.0

func GenerateGitHubAppsToken(ctx context.Context, clientApps *github.Client, installationID int64) (string, *time.Time, error)

GenerateGitHubAppsToken generate token of GitHub Apps using private key clientApps needs to response of `NewClientGitHubApps()`

func GenerateRunnerRegistrationToken added in v1.9.11

func GenerateRunnerRegistrationToken(ctx context.Context, gheDomain string, installationID int64, scope string) (string, *time.Time, error)

GenerateRunnerRegistrationToken generate token for register runner

func IsInstalledGitHubApp added in v1.7.0

func IsInstalledGitHubApp(ctx context.Context, gheDomain, inputScope string) (int64, error)

IsInstalledGitHubApp check installed GitHub Apps in gheDomain + inputScope

func ListRunners added in v1.6.1

func ListRunners(ctx context.Context, client *github.Client, owner, repo string) ([]*github.Runner, error)

ListRunners get runners that registered repository or org

func NewClient

func NewClient(ctx context.Context, personalToken, gheDomain string) (*github.Client, error)

NewClient create a client of GitHub

func NewClientGitHubApps added in v1.9.7

func NewClientGitHubApps(gheDomain string, appID int64, appPEM []byte) (*github.Client, error)

NewClientGitHubApps create a client of GitHub using Private Key from GitHub Apps header is "Authorization: Bearer YOUR_JWT" docs: https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app

func NewClientInstallation added in v1.9.7

func NewClientInstallation(gheDomain string, installationID int64, appID int64, appPEM []byte) (*github.Client, error)

NewClientInstallation create a client of GitHub using installation ID from GitHub Apps header is "Authorization: token YOUR_INSTALLATION_ACCESS_TOKEN" docs: https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-an-installation

Types

type Scope

type Scope int

Scope is scope for auto-scaling target

const (
	Unknown Scope = iota
	Repository
	Organization
)

Scope values

func DetectScope

func DetectScope(scope string) Scope

DetectScope detect a scope (repo or org)

func (Scope) String

func (s Scope) String() string

String is fmt.Stringer interface

Jump to

Keyboard shortcuts

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