github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 17 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 struct {
	// contains filtered or unexported fields
}

Client is a GitHub API client.

func NewClient

func NewClient(appID int64, privateKeyPEM []byte) (*Client, error)

NewClient creates a new GitHub client with App authentication.

func (*Client) DispatchWorkflow

func (c *Client) DispatchWorkflow(ctx context.Context, owner, repo, workflowFile, ref string) error

DispatchWorkflow triggers a workflow_dispatch event.

func (*Client) GetFileContent

func (c *Client) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)

GetFileContent returns the content of a file in a repository.

func (*Client) GetInstallationRepos

func (c *Client) GetInstallationRepos(ctx context.Context) ([]Repository, error)

GetInstallationRepos returns all repositories accessible to the installation.

func (*Client) GetVariable

func (c *Client) GetVariable(ctx context.Context, owner, repo, name string) (string, error)

GetVariable returns the value of a repository Actions variable.

func (*Client) GetWorkflowFiles

func (c *Client) GetWorkflowFiles(ctx context.Context, owner, repo string) ([]WorkflowFile, error)

GetWorkflowFiles returns workflow files under .github/workflows/.

func (*Client) SetVariable

func (c *Client) SetVariable(ctx context.Context, owner, repo, name, value string) error

SetVariable creates or updates a repository Actions variable.

type CronAnnotation

type CronAnnotation struct {
	Owner        string // repository owner
	Repo         string // repository name
	WorkflowFile string // workflow file name (e.g. "build.yml")
	CronExpr     string // cron expression (5-field standard format)
	Ref          string // default branch
}

CronAnnotation represents a cron annotation extracted from a workflow file.

func (*CronAnnotation) Key

func (a *CronAnnotation) Key() CronJobKey

Key generates a CronJobKey from a CronAnnotation.

type CronJobKey

type CronJobKey struct {
	Owner        string
	Repo         string
	WorkflowFile string
	CronExpr     string
}

CronJobKey uniquely identifies a cron job.

type Repository

type Repository struct {
	Owner         string
	Name          string
	DefaultBranch string
}

Repository represents a GitHub App installation repository.

type Transport

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

Transport is an http.RoundTripper that authenticates using a GitHub App installation token.

func NewTransport

func NewTransport(appID int64, privateKeyPEM []byte) (*Transport, error)

NewTransport creates a new Transport from an App ID and PEM-encoded private key.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip adds an installation token to the request and sends it.

type WorkflowFile

type WorkflowFile struct {
	Name string // file name (e.g. "build.yml")
	Path string // full path (e.g. ".github/workflows/build.yml")
}

WorkflowFile represents a workflow file in a repository.

Jump to

Keyboard shortcuts

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