githubactions

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package githubactions provides a GitHub Actions API client implementing the external.TestRunner interface. It supports triggering workflow runs via repository_dispatch or workflow_dispatch events, polling run status, and retrieving workflow logs.

GitHub Actions API documentation: https://docs.github.com/en/rest/actions

Authentication uses a GitHub Personal Access Token (PAT) or GitHub App token. The token must have 'actions:read' and 'actions:write' permissions.

All API calls use exponential backoff retries for transient failures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a GitHub Actions API client implementing external.TestRunner.

func NewClient

func NewClient(config external.ProviderConfig) (*Client, error)

NewClient creates a new GitHub Actions client with the given configuration. The token should be a GitHub PAT or GitHub App token with actions permissions. Returns an error if the configuration is invalid.

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, runID string) error

Cancel attempts to cancel a running workflow run. The runID is expected in the format "owner:repo:runID" as returned by TriggerTest.

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, runID string) (string, error)

GetLogs retrieves the logs for a workflow run. The runID is expected in the format "owner:repo:runID" as returned by TriggerTest. Note: GitHub Actions logs are returned as a zip archive. For simplicity, this implementation returns a URL to view logs in the web UI.

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context, runID string) (external.TestStatus, error)

GetStatus polls the status of a GitHub Actions workflow run. The runID is expected in the format "owner:repo:runID" as returned by TriggerTest. Returns the current workflow run status as a TestStatus.

func (*Client) TriggerTest

func (c *Client) TriggerTest(ctx context.Context, config external.TestConfig) (*external.TestRun, error)

TriggerTest triggers a GitHub Actions workflow run via workflow_dispatch. The JobName should be either the workflow file name (e.g., "ci.yml") or workflow ID. Parameters are passed as workflow inputs. Must include "owner" and "repo" parameters. The Ref specifies which branch/tag/SHA to run the workflow against. Returns a TestRun with the workflow run ID and metadata. The runID is encoded as "owner:repo:runID" to include all necessary information.

Jump to

Keyboard shortcuts

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