Documentation
¶
Index ¶
- Variables
- func CheckSignature(installationID int64) error
- func ConcatLabels(checkEventJSON string) (string, error)
- func DivideScope(scope string) (string, string)
- func ExistGitHubRepository(scope string, accessToken string) error
- func ExistGitHubRunner(ctx context.Context, client *github.Client, owner, repo, runnerName string) (*github.Runner, error)
- func ExistGitHubRunnerWithRunner(runners []*github.Runner, runnerName string) (*github.Runner, error)
- func ExistRunnerReleases(runnerVersion string) error
- func ExtractRunsOnLabels(in []byte) ([]string, error)
- func GenerateGitHubAppsToken(ctx context.Context, clientApps *github.Client, installationID int64, ...) (string, *time.Time, error)
- func GetInstallationByID(ctx context.Context, installationID int64) (*github.Installation, error)
- func GetLatestRunnerVersion(ctx context.Context, scope string) (string, error)
- func GetRateLimitLimit() map[string]int
- func GetRateLimitRemain() map[string]int
- func GetRunnerRegistrationToken(ctx context.Context, installationID int64, scope string) (string, error)
- func InitializeCache(appID int64, appPEM []byte) error
- func IsInstalledGitHubApp(ctx context.Context, inputScope string) (int64, error)
- func IsRequestedMyshoesLabel(labels []string) bool
- func ListRunners(ctx context.Context, client *github.Client, owner, repo string) ([]*github.Runner, error)
- func ListWorkflowJobByRunID(ctx context.Context, client *github.Client, owner, repo string, runID int64) ([]*github.WorkflowJob, error)
- func ListWorkflowRunsNewest(ctx context.Context, client *github.Client, owner, repo string, limit int) ([]*github.WorkflowRun, error)
- func NewClient(token string) (*github.Client, error)
- func NewClientGitHubApps() (*github.Client, error)
- func NewClientInstallation(installationID int64) (*github.Client, error)
- func PurgeInstallationCache(ctx context.Context) error
- type ErrIsNotInstalledGitHubApps
- type Scope
Constants ¶
This section is empty.
Variables ¶
var ( GHlistInstallations = listInstallations GHlistAppsInstalledRepo = listAppsInstalledRepo )
function pointers (for testing)
var ( // ErrNotFound is error for not found ErrNotFound = fmt.Errorf("not found") )
Functions ¶
func CheckSignature ¶
CheckSignature check trust installation id from event.
func ConcatLabels ¶ added in v1.16.0
ConcatLabels concat labels from check event JSON
func DivideScope ¶ added in v1.6.1
DivideScope divide scope to owner and repo
func ExistGitHubRepository ¶
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
ExistRunnerReleases check exist of runner file
func ExtractRunsOnLabels ¶ added in v1.12.0
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 GetInstallationByID ¶ added in v1.18.2
GetInstallationByID returns installation from cache by ID
func GetLatestRunnerVersion ¶ added in v1.13.0
GetLatestRunnerVersion get a latest version of actions/runner
func GetRateLimitLimit ¶ added in v1.10.5
GetRateLimitLimit get a list of rate limit key: scope, value: remain
func GetRateLimitRemain ¶ added in v1.10.5
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
InitializeCache create a cache
func IsInstalledGitHubApp ¶ added in v1.7.0
IsInstalledGitHubApp check installed GitHub Apps in gheDomain + inputScope clientApps needs to response of `NewClientGitHubApps()`
func IsRequestedMyshoesLabel ¶ added in v1.18.5
IsRequestedMyshoesLabel checks if the job has appropriate labels for myshoes
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 ListWorkflowJobByRunID ¶ added in v1.18.0
func ListWorkflowJobByRunID(ctx context.Context, client *github.Client, owner, repo string, runID int64) ([]*github.WorkflowJob, error)
ListWorkflowJobByRunID get workflow job by run ID
func ListWorkflowRunsNewest ¶ added in v1.18.0
func ListWorkflowRunsNewest(ctx context.Context, client *github.Client, owner, repo string, limit int) ([]*github.WorkflowRun, error)
ListWorkflowRunsNewest get workflow runs that registered in the last (%d: limit) runs
func NewClientGitHubApps ¶ added in v1.9.7
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
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
func PurgeInstallationCache ¶ added in v1.18.0
PurgeInstallationCache purges the cache of installations
Types ¶
type ErrIsNotInstalledGitHubApps ¶ added in v1.18.0
type ErrIsNotInstalledGitHubApps struct {
// contains filtered or unexported fields
}
func (*ErrIsNotInstalledGitHubApps) Error ¶ added in v1.18.0
func (e *ErrIsNotInstalledGitHubApps) Error() string
func (*ErrIsNotInstalledGitHubApps) Unwrap ¶ added in v1.18.0
func (e *ErrIsNotInstalledGitHubApps) Unwrap() error