github

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetOrganizationName() string
	CreateRegistrationToken(context.Context, string) (*github.RegistrationToken, error)
	ListRunners(context.Context, string, []string) ([]*Runner, error)
	RemoveRunner(context.Context, string, int64) error
}

Client generates token for GitHub Action selfhosted runner

func NewClient

func NewClient(
	appID int64,
	appInstallationID int64,
	appPrivateKeyPath string,
	organizationName string,
) (Client, error)

NewClient creates GitHub Actions Client

type FakeClient

type FakeClient struct {
	ExpiredAtDuration time.Duration
	// contains filtered or unexported fields
}

FakeClient is a fake client

func NewFakeClient

func NewFakeClient(organizationName string) *FakeClient

NewFakeClient creates GitHub Actions Client.

func (*FakeClient) CreateRegistrationToken

func (c *FakeClient) CreateRegistrationToken(ctx context.Context, repositoryName string) (*github.RegistrationToken, error)

CreateRegistrationToken returns dummy token.

func (*FakeClient) GetOrganizationName

func (c *FakeClient) GetOrganizationName() string

GetOrganizationName returns organizationName.

func (*FakeClient) ListRunners

func (c *FakeClient) ListRunners(ctx context.Context, repositoryName string, labels []string) ([]*Runner, error)

ListRunners returns dummy list.

func (*FakeClient) RemoveRunner

func (c *FakeClient) RemoveRunner(ctx context.Context, repositoryName string, runnerID int64) error

RemoveRunner does not delete anything and returns success.

func (*FakeClient) SetRunners

func (c *FakeClient) SetRunners(runners map[string][]*Runner)

SetRunners sets runners for multiple repositories

type Runner

type Runner struct {
	ID     int64
	Name   string
	Online bool
	Busy   bool
	Labels []string
}

Jump to

Keyboard shortcuts

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