internal

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package internal implements the workflow-plugin-github plugin, providing GitHub webhook handling and GitHub Actions workflow management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitHubPlugin

func NewGitHubPlugin() sdk.PluginProvider

NewGitHubPlugin returns a new githubPlugin instance.

Types

type CheckRun

type CheckRun struct {
	ID      int64  `json:"id"`
	HTMLURL string `json:"html_url"`
	Status  string `json:"status"`
}

CheckRun represents a GitHub Check Run response.

type CheckRunOutput

type CheckRunOutput struct {
	Title   string `json:"title"`
	Summary string `json:"summary"`
}

CheckRunOutput holds the title and summary for a check run.

type CreateCheckRunRequest

type CreateCheckRunRequest struct {
	Name       string          `json:"name"`
	HeadSHA    string          `json:"head_sha"`
	Status     string          `json:"status"`
	Conclusion string          `json:"conclusion,omitempty"`
	Output     *CheckRunOutput `json:"output,omitempty"`
}

CreateCheckRunRequest holds parameters for creating a GitHub Check Run.

type GitEvent

type GitEvent struct {
	Provider   string          `json:"provider"`    // "github"
	EventType  string          `json:"event_type"`  // "push", "pull_request", etc.
	Repository string          `json:"repository"`  // "owner/repo"
	Branch     string          `json:"branch"`      // "main", "feature/xyz"
	Commit     string          `json:"commit"`      // SHA
	Author     string          `json:"author"`      // username
	Message    string          `json:"message"`     // commit message or PR title
	URL        string          `json:"url"`         // link to commit/PR
	RawPayload json.RawMessage `json:"raw_payload"` // original payload
	Timestamp  time.Time       `json:"timestamp"`
}

GitEvent is the normalized event schema published to the message broker.

type GitHubClient

type GitHubClient interface {
	TriggerWorkflow(ctx context.Context, owner, repo, workflow, ref string, inputs map[string]string, token string) error
	GetWorkflowRun(ctx context.Context, owner, repo string, runID int64, token string) (*WorkflowRun, error)
	CreateCheckRun(ctx context.Context, owner, repo string, req *CreateCheckRunRequest, token string) (*CheckRun, error)
}

GitHubClient is the interface for interacting with the GitHub API. It is defined as an interface so tests can inject a mock.

type WorkflowRun

type WorkflowRun struct {
	ID         int64  `json:"id"`
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
	HTMLURL    string `json:"html_url"`
}

WorkflowRun represents a GitHub Actions workflow run.

Jump to

Keyboard shortcuts

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