gh

package
v1.15.10 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GHlistInstallations     = listInstallations
	GHlistAppsInstalledRepo = listAppsInstalledRepo
)

function pointers (for testing)

View Source
var ActiveTargets = sync.Map{}

ActiveTargets stores targets by recently received webhook

View Source
var (
	// ErrNotFound is error for not found
	ErrNotFound = fmt.Errorf("not found")
)
View Source
var PendingRuns = sync.Map{}

PendingRuns stores queued / pending workflow runs

Functions

func CheckSignature

func CheckSignature(installationID int64) error

CheckSignature check trust installation id from event.

func ClearRunsCache added in v1.15.1

func ClearRunsCache(owner, repo string)

ClearRunsCache clear github workflow run caches

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 string, accessToken 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 ExistGitHubRunnerWithRunner added in v1.10.7

func ExistGitHubRunnerWithRunner(runners []*github.Runner, runnerName string) (*github.Runner, error)

ExistGitHubRunnerWithRunner check exist registered of GitHub runner from a list of runner

func ExistRunnerReleases added in v1.10.10

func ExistRunnerReleases(runnerVersion string) error

ExistRunnerReleases check exist of runner file

func ExtractRunsOnLabels added in v1.12.0

func ExtractRunsOnLabels(in []byte) ([]string, error)

ExtractRunsOnLabels extract labels from github.WorkflowJobEvent

func GenerateGitHubAppsToken added in v1.7.0

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

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

func GetLatestRunnerVersion added in v1.13.0

func GetLatestRunnerVersion(ctx context.Context, scope, token string) (string, error)

GetLatestRunnerVersion get a latest version of actions/runner

func GetRateLimitLimit added in v1.10.5

func GetRateLimitLimit() map[string]int

GetRateLimitLimit get a list of rate limit key: scope, value: remain

func GetRateLimitRemain added in v1.10.5

func GetRateLimitRemain() map[string]int

GetRateLimitRemain get a list of rate limit remaining key: scope, value: remain

func GetRunnerRegistrationToken added in v1.10.6

func GetRunnerRegistrationToken(ctx context.Context, installationID int64, scope string) (string, error)

GetRunnerRegistrationToken get token for register runner clientInstallation needs to response of `NewClientInstallation()`

func InitializeCache added in v1.10.6

func InitializeCache(appID int64, appPEM []byte) error

InitializeCache create a cache

func IsInstalledGitHubApp added in v1.7.0

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

IsInstalledGitHubApp check installed GitHub Apps in gheDomain + inputScope clientApps needs to response of `NewClientGitHubApps()`

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 ListRuns added in v1.15.1

func ListRuns(owner, repo string) ([]*github.WorkflowRun, error)

ListRuns get workflow runs that registered repository

func NewClient

func NewClient(token string) (*github.Client, error)

NewClient create a client of GitHub

func NewClientGitHubApps added in v1.9.7

func NewClientGitHubApps() (*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(installationID int64) (*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