github

package
v0.0.0-...-06b15b2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAppInstallID

func FindAppInstallID(ctx context.Context, lister InstallationLister, owner string) (int64, error)

FindAppInstallID finds the ID of an app installation on a given GitHub account. The App ID is inferred by the credentials used by the `lister` to authenticate with the GitHub API

func ListWorkflowJobs

func ListWorkflowJobs(ctx context.Context, lister WorkflowJobLister, owner, repo string, runID int64) ([]*github.WorkflowJob, error)

ListWorkflowJobs lists the jobs for a given workflow run in the specified repository.

func ListWorkflowRuns

func ListWorkflowRuns(ctx context.Context, actions WorkflowRuns, owner, repo, path, branch string, since time.Time) ([]*github.WorkflowRun, error)

Returns information about all matched runs started after `since`.

func WaitForRun

func WaitForRun(ctx context.Context, actions WorkflowRuns, owner, repo, path string, runID int64) (string, error)

WaitForRun blocks until the specified workflow run completes, and returns the overall workflow status.

Types

type GitHub

type GitHub interface {
	ListReleases(ctx context.Context, organization, repository string) ([]github.RepositoryRelease, error)
}

GitHub is a minimal GitHub client for ease of use

func NewGitHub

func NewGitHub() GitHub

NewGitHub returns a new instance of the minimal GitHub client

func NewGitHubWithToken

func NewGitHubWithToken(ctx context.Context, token string) GitHub

NewGitHub returns a new instance of the minimal GitHub client that authenticates to GitHub with a Personal Access Token (or other oauth token).

type InstallationLister

type InstallationLister interface {
	ListInstallations(ctx context.Context, opts *github.ListOptions) ([]*github.Installation, *github.Response, error)
}

InstallationLister defines the minimal interface for listing GitHub App Installations via the GitHub API.

type RunIDSet

type RunIDSet map[int64]struct{}

func ListWorkflowRunIDs

func ListWorkflowRunIDs(ctx context.Context, actions WorkflowRuns, owner, repo, path, branch string, since time.Time) (RunIDSet, error)

ListWorkflowRunIDs returns a set of RunIDs, representing the set of all for workflow runs created since the supplied start time.

func (RunIDSet) Equals

func (s RunIDSet) Equals(other RunIDSet) bool

Equals performs a deep comparison of the set values

func (RunIDSet) Insert

func (s RunIDSet) Insert(runID int64)

Insert adds an element to a set. Adding an element multiple times is not considered an error.

func (RunIDSet) NotIn

func (s RunIDSet) NotIn(other RunIDSet) RunIDSet

NotIn returns the elements that are in `s` but not in `other`

type WorkflowJobLister

type WorkflowJobLister interface {
	ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *github.ListWorkflowJobsOptions) (*github.Jobs, *github.Response, error)
}

WorkflowJobLister defines the minimal GitHub client interafce required to list query and compose workflow jobs.

type WorkflowRuns

type WorkflowRuns interface {
	GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*github.WorkflowRun, *github.Response, error)
	ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *github.ListWorkflowRunsOptions) (*github.WorkflowRuns, *github.Response, error)
}

WorkflowRuns defines the minimal API used to lst and query GitHub action runner workflows and jobs

Jump to

Keyboard shortcuts

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