dispatch

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindRun

func FindRun(client *github.Client, opts Options, runName string) (github.WorkflowRun, error)

FindRun finds the most recent GitHub Actions run matching a given run name.

FindRun requires that the `run-name:` tag in a workflow match the `runName` input. For more information about how `run-name:` works in GitHub Actions, refer to: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#run-name

Polling is defined by the `Options.SecondsBetweenPolls` parameter. If no run is returned after `Options.MaxAttempts` attempts, an error is returned

func WaitRunFinished

func WaitRunFinished(client *github.Client, opts Options, run github.WorkflowRun) error

WaitRunFinished watches a GitHub Actions Workflow Run and returns once the workflow has finished processing

func Worker

func Worker(client *github.Client, opts Options, id int, jobs <-chan string, results chan<- Result)

Worker spawns an instance of a goroutine that listens for new job requests and then processes those requests until complete. Multiple workers can be instantiated to create a pool for concurrent processing.

Workers create a GitHub Actions workflow run and follow the status of the job until it completes or errors out. The `results` channel is populated with the outcome of any jobs.

Types

type Options

type Options struct {
	SecondsBetweenPolls int
	MaxAttempts         int
	Logger              hclog.Logger
	BranchRef           string
	BatchID             string
	WorkflowFileName    string
	GitHubOwner         string
	GitHubRepo          string
}

Options provides a way to define how frequently the GitHub APIs should be polled for results, as well as the maximum number of attempts before stopping

type Result

type Result struct {
	Name    string
	Success bool
	Error   error
}

Result reports on the outcome of a given job, including if it was successful or not, and (if unsuccessful) details on any errors that ocurred

Jump to

Keyboard shortcuts

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