github

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 11 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 implements remote.Provider for GitHub Actions

func NewClient

func NewClient(token, owner, repo string) *Client

NewClient creates a new GitHub client with token authentication

func NewClientFromEnv

func NewClientFromEnv() (*Client, error)

NewClientFromEnv creates a GitHub client using environment variables and git remote

func NewClientWithBaseURL

func NewClientWithBaseURL(token, owner, repo, baseURL string) (*Client, error)

NewClientWithBaseURL creates a new GitHub client for GitHub Enterprise with custom base URL

func (*Client) CreatePullRequest

func (c *Client) CreatePullRequest(ctx context.Context, title, body, head, base string, draft bool) (int, string, error)

CreatePullRequest creates a new pull request

func (*Client) DeleteAllArtifacts

func (c *Client) DeleteAllArtifacts(ctx context.Context) (deleted int, freedBytes int64, err error)

DeleteAllArtifacts deletes all artifacts in the repository

func (*Client) DeleteArtifact

func (c *Client) DeleteArtifact(ctx context.Context, artifactID int64) error

DeleteArtifact deletes a single artifact by ID

func (*Client) DeleteArtifactsBefore

func (c *Client) DeleteArtifactsBefore(ctx context.Context, before time.Time) (deleted int, freedBytes int64, err error)

DeleteArtifactsBefore deletes all artifacts created before the given time

func (*Client) DeleteExpiredArtifacts

func (c *Client) DeleteExpiredArtifacts(ctx context.Context) (deleted int, freedBytes int64, err error)

DeleteExpiredArtifacts deletes all expired artifacts

func (*Client) GetLatestRunForBranch

func (c *Client) GetLatestRunForBranch(ctx context.Context, branch string) (*remote.Workflow, error)

GetLatestRunForBranch returns the most recent workflow run on a branch across all workflows in the repository. Unlike GetLatestWorkflow, it is not scoped to a specific workflow filename, so it works for repositories that don't use cidx-generated workflows. Used by `cidx workflow watch` to support watching runs on non-PR branches (issue #125).

func (*Client) GetLatestRunForTag added in v2.1.5

func (c *Client) GetLatestRunForTag(ctx context.Context, tag string) (*remote.Workflow, error)

GetLatestRunForTag returns the most recent workflow run triggered by the push of a tag. GitHub records the ref that started a run in head_branch -- for a tag push that is the tag name -- and the repository-wide runs listing filters on it. Resolving by ref instead of by workflow file name means the release workflow is found whatever it is called, and the runs that a branch push of the very same commit produced (CI, nightly) are left out because their ref is the branch, not the tag (issue #223).

func (*Client) GetLatestWorkflow

func (c *Client) GetLatestWorkflow(ctx context.Context, branch string) (*remote.Workflow, error)

GetLatestWorkflow returns the most recent workflow run for a branch. The workflow filename is not hardcoded: the candidate names from remote.CandidateWorkflowFiles are probed in preference order, so both generated projects (cidx.yml) and repos with a conventional ci.yml work without configuration (issue #170).

func (*Client) GetPullRequest

func (c *Client) GetPullRequest(ctx context.Context, prNumber int) (*github.PullRequest, error)

GetPullRequest returns a single pull request by number

func (*Client) GetPullRequestByBranch

func (c *Client) GetPullRequestByBranch(ctx context.Context, branch string) (int, string, error)

GetPullRequestByBranch finds a PR for the given head branch

func (*Client) GetPullRequestChecks

func (c *Client) GetPullRequestChecks(ctx context.Context, prNumber int) (*remote.PRChecks, error)

GetPullRequestChecks returns the status of all checks/workflows for a PR

func (*Client) GetPullRequestDetails

func (c *Client) GetPullRequestDetails(ctx context.Context, prNumber int) (*remote.PullRequestDetails, error)

GetPullRequestDetails returns comprehensive PR details for TUI display

func (*Client) GetPullRequestReviews

func (c *Client) GetPullRequestReviews(ctx context.Context, prNumber int) ([]*github.PullRequestReview, error)

GetPullRequestReviews returns reviews for a pull request

func (*Client) GetWorkflowRun

func (c *Client) GetWorkflowRun(ctx context.Context, runID string) (*remote.Workflow, error)

GetWorkflowRun returns a workflow run by its ID. Used by `cidx workflow watch --run <id>` to watch a specific run.

func (*Client) ListArtifacts

func (c *Client) ListArtifacts(ctx context.Context) (*remote.ArtifactStats, error)

ListArtifacts returns all artifacts for the repository with storage statistics

func (*Client) ListPullRequests

func (c *Client) ListPullRequests(ctx context.Context, state string) ([]*github.PullRequest, error)

ListPullRequests lists pull requests with the given state (open, closed, all)

func (*Client) MarkPullRequestReady

func (c *Client) MarkPullRequestReady(ctx context.Context, prNumber int) error

MarkPullRequestReady marks a draft PR as ready for review

func (*Client) MergePullRequest

func (c *Client) MergePullRequest(ctx context.Context, prNumber int, method string) error

MergePullRequest merges a pull request

func (*Client) UpdatePullRequest

func (c *Client) UpdatePullRequest(ctx context.Context, prNumber int, title, body string) error

UpdatePullRequest updates the title and/or body of a pull request. Empty strings leave the corresponding field unchanged.

func (*Client) WaitForChecksToStart

func (c *Client) WaitForChecksToStart(ctx context.Context, prNumber int, expectedSHA string, timeout time.Duration) (string, *remote.PRChecks, error)

WaitForChecksToStart waits for CI checks to start for a PR This solves the race condition where CI hasn't started yet when we query

func (*Client) WatchPullRequestChecks

func (c *Client) WatchPullRequestChecks(ctx context.Context, prNumber int) (<-chan remote.PRChecksUpdate, error)

WatchPullRequestChecks streams updates for PR checks until all complete

func (*Client) WatchWorkflow

func (c *Client) WatchWorkflow(ctx context.Context, workflowID string) (<-chan remote.WorkflowUpdate, error)

WatchWorkflow streams updates for a running workflow

Jump to

Keyboard shortcuts

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