github

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package github implements forge.Client for the GitHub REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAgentRoles

func DefaultAgentRoles() []string

DefaultAgentRoles returns the standard set of agent roles.

func IsPATForbiddenError added in v0.30.0

func IsPATForbiddenError(err error) bool

IsPATForbiddenError reports whether err is a GitHub 403 indicating that the org forbids classic personal access tokens. This specific message means the caller needs a fine-grained PAT, GitHub App, or OAuth App token instead.

func IsRateLimitError added in v0.27.0

func IsRateLimitError(err error) bool

IsRateLimitError reports whether err is a GitHub rate-limit error (primary 429, primary-as-403, or secondary 403). It unwraps the error chain, so wrapped errors are detected too.

func ListInstallationRepositories added in v0.24.0

func ListInstallationRepositories(ctx context.Context, httpClient *http.Client, baseURL, token string, perPage int) (repos []string, totalCount int, ok bool, err error)

ListInstallationRepositories returns repository full names when token is a GitHub App installation token (HTTP 200). PATs and OAuth tokens that lack installation access receive 401/403 and return (nil, 0, false, nil).

func ProbeInstallationToken added in v0.24.0

func ProbeInstallationToken(ctx context.Context, httpClient *http.Client, baseURL, token string) (bool, error)

ProbeInstallationToken reports whether token is a GitHub App installation access token by calling GET /installation/repositories. PATs and OAuth tokens receive 401/403 on that endpoint.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Errors     []APIErrorDetail
}

APIError represents an error response from the GitHub API.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

Unwrap returns sentinel errors for well-known API responses.

ErrBranchProtected is intentionally NOT mapped here. Branch protection 422s are context-dependent: the word "protected" in a validation error only signals a branch-protection failure when it comes from a ref update (PATCH /git/refs). Other 422s may coincidentally mention "protected" in unrelated contexts. The wrapping happens in commitFilesTo where the operation context is known.

ErrForbidden is intentionally NOT mapped here either. HTTP 403 can indicate secondary rate limits (handled by isRetryable), SAML SSO enforcement, or other policy-based denials — not only permission failures. The wrapping happens at call sites (e.g., CreateBranch) where the operation context disambiguates the cause.

type APIErrorDetail added in v0.8.0

type APIErrorDetail struct {
	Resource string `json:"resource"`
	Field    string `json:"field"`
	Code     string `json:"code"`
	Message  string `json:"message"`
}

APIErrorDetail is one validation error entry returned by GitHub.

type AppConfig

type AppConfig struct {
	Name           string         `json:"name"`
	Description    string         `json:"description"`
	URL            string         `json:"url"`
	HookAttributes HookAttributes `json:"hook_attributes"`
	RedirectURL    string         `json:"redirect_url,omitempty"`
	Public         bool           `json:"public"`
	Permissions    AppPermissions `json:"default_permissions"`
	Events         []string       `json:"default_events"`
}

AppConfig defines the configuration for creating a GitHub App via the manifest flow. See https://docs.github.com/en/apps/sharing-github-apps/registering-a-github-app-from-a-manifest

func AgentAppConfig

func AgentAppConfig(org, role, appSet string) AppConfig

AgentAppConfig returns the GitHub App configuration for a given agent role.

Important: GitHub validates that event subscriptions are backed by matching permissions. For example, subscribing to "issues" events requires at least issues:read permission. Subscribing to "issue_comment" requires issues:read or issues:write. Mismatches cause the manifest to be rejected. Every Events entry below must have a corresponding permission.

type AppPermissions

type AppPermissions struct {
	Actions                    string `json:"actions,omitempty"`
	Issues                     string `json:"issues,omitempty"`
	PullRequests               string `json:"pull_requests,omitempty"`
	Checks                     string `json:"checks,omitempty"`
	Contents                   string `json:"contents,omitempty"`
	Variables                  string `json:"actions_variables,omitempty"`
	Workflows                  string `json:"workflows,omitempty"`
	Administration             string `json:"administration,omitempty"`
	Members                    string `json:"members,omitempty"`
	OrganizationProjects       string `json:"organization_projects,omitempty"`
	OrganizationAdministration string `json:"organization_administration,omitempty"`
	// OrganizationActionsVariables is org-level Actions variables (distinct from
	// repository actions_variables). Required to read FULLSEND_FOREIGN_* via the org API.
	OrganizationActionsVariables string `json:"organization_actions_variables,omitempty"`
	Secrets                      string `json:"secrets,omitempty"`
}

AppPermissions defines the permissions for a GitHub App.

type HookAttributes

type HookAttributes struct {
	URL    string `json:"url"`
	Active bool   `json:"active"`
}

HookAttributes configures the webhook for a GitHub App. Even when webhooks are not used, GitHub requires this field in the manifest.

type LiveClient

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

LiveClient implements forge.Client for the GitHub REST API.

func New

func New(token string) *LiveClient

New creates a new GitHub client with the given personal access token.

func (*LiveClient) AddIssueLabels added in v0.30.0

func (c *LiveClient) AddIssueLabels(ctx context.Context, owner, repo string, number int, labels ...string) error

AddIssueLabels adds labels to an existing issue.

func (*LiveClient) CloseIssue added in v0.0.3

func (c *LiveClient) CloseIssue(ctx context.Context, owner, repo string, number int) error

CloseIssue closes an issue by number.

func (*LiveClient) CommitFiles added in v0.6.0

func (c *LiveClient) CommitFiles(ctx context.Context, owner, repo, message string, files []forge.TreeFile) (bool, error)

CommitFiles atomically commits multiple files to the default branch using the Git Trees/Blobs/Commits API. Returns (false, nil) when all files already match the current tree (idempotent). Text files are embedded as UTF-8 tree content. Binary files (e.g. vendored ELF) are uploaded via the Git Blob API and referenced by SHA.

Returns forge.ErrBranchProtected (wrapped) when the ref update fails with a 422, which indicates branch protection rules prevent direct pushes.

func (*LiveClient) CommitFilesToBranch added in v0.18.0

func (c *LiveClient) CommitFilesToBranch(ctx context.Context, owner, repo, branch, message string, files []forge.TreeFile) (bool, error)

CommitFilesToBranch atomically commits multiple files to a specific branch. Like CommitFiles, it is idempotent.

func (*LiveClient) CreateBranch

func (c *LiveClient) CreateBranch(ctx context.Context, owner, repo, branchName string) error

CreateBranch creates a new branch from the repository's default branch.

func (*LiveClient) CreateChangeProposal

func (c *LiveClient) CreateChangeProposal(ctx context.Context, owner, repo, title, body, head, base string) (*forge.ChangeProposal, error)

CreateChangeProposal creates a pull request.

func (*LiveClient) CreateFile

func (c *LiveClient) CreateFile(ctx context.Context, owner, repo, path, message string, content []byte) error

CreateFile creates a new file on the repository's default branch.

func (*LiveClient) CreateFileOnBranch

func (c *LiveClient) CreateFileOnBranch(ctx context.Context, owner, repo, branch, path, message string, content []byte) error

CreateFileOnBranch creates a file on a specific branch (or default if empty).

Retries on 404 to handle GitHub's async repo initialization: after CreateRepo with auto_init, the default branch may not be materialized yet and the Contents API returns 404. Also retries on 409 (conflict) which can occur when the branch ref is being updated by a concurrent write.

GitHub quirk: writing to .github/workflows/ paths returns 404 (not 403) when the token lacks the "workflow" scope. If you hit persistent 404s on workflow file creation, the fix is: gh auth refresh -s workflow

func (*LiveClient) CreateFork added in v0.24.0

func (c *LiveClient) CreateFork(ctx context.Context, owner, repo string) (string, string, error)

CreateFork creates a fork of owner/repo under the authenticated user's account. If a fork already exists, the GitHub API returns 202 with the existing fork metadata, so this call is idempotent. Returns both the fork owner login and the actual repo name. The repo name may differ from the upstream when the user already has an unrelated repo with the same name (GitHub appends a suffix like "-1").

func (*LiveClient) CreateForkInOrg added in v0.32.0

func (c *LiveClient) CreateForkInOrg(ctx context.Context, owner, repo, org, forkName string) (string, error)

CreateForkInOrg creates a fork of owner/repo under the specified organization with the given name. If a fork of the source already exists with the given name, the GitHub API returns 202 with the existing fork metadata, so this call is idempotent. Returns the actual repo name from the API response.

If a repository with the target name already exists but is not a fork of the source, returns forge.ErrNotFork. This pre-check prevents a generic GitHub 422 error with a specific sentinel so callers can handle the collision gracefully.

func (*LiveClient) CreateIssue added in v0.0.3

func (c *LiveClient) CreateIssue(ctx context.Context, owner, repo, title, body string, labels ...string) (*forge.Issue, error)

CreateIssue creates a new issue on a repository. Labels are best-effort: if GitHub rejects the create because a label is unavailable in the target repo, the request is retried without labels so issue creation still succeeds.

func (*LiveClient) CreateIssueComment added in v0.2.0

func (c *LiveClient) CreateIssueComment(ctx context.Context, owner, repo string, number int, body string) (*forge.IssueComment, error)

CreateIssueComment creates a new comment on an issue or pull request.

func (*LiveClient) CreateOrUpdateFile

func (c *LiveClient) CreateOrUpdateFile(ctx context.Context, owner, repo, path, message string, content []byte) error

CreateOrUpdateFile creates a file or updates it if it already exists. Retries on 404/409 to handle async repo initialization and branch ref races.

func (*LiveClient) CreateOrUpdateFileOnBranch

func (c *LiveClient) CreateOrUpdateFileOnBranch(ctx context.Context, owner, repo, branch, path, message string, content []byte) error

CreateOrUpdateFileOnBranch creates or updates a file on a specific branch. Like CreateOrUpdateFile, it fetches the existing SHA before updating. Retries on 404/409 for async repo init and branch ref races.

func (*LiveClient) CreateOrUpdateOrgVariable added in v0.8.0

func (c *LiveClient) CreateOrUpdateOrgVariable(ctx context.Context, org, name, value string, selectedRepoIDs []int64) error

CreateOrUpdateOrgVariable creates or updates an org-level Actions variable scoped to the given repository IDs.

func (*LiveClient) CreateOrUpdateOrgVariableAll added in v0.24.0

func (c *LiveClient) CreateOrUpdateOrgVariableAll(ctx context.Context, org, name, value string) error

CreateOrUpdateOrgVariableAll creates or updates an org-level Actions variable visible to all repositories in the org (visibility all).

func (*LiveClient) CreateOrUpdateRepoVariable

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

CreateOrUpdateRepoVariable creates or updates a repository Actions variable.

func (*LiveClient) CreateOrgSecret

func (c *LiveClient) CreateOrgSecret(ctx context.Context, org, name, value string, selectedRepoIDs []int64) error

CreateOrgSecret creates or updates an encrypted organization-level secret scoped to the given repository IDs. The value is trimmed of whitespace before encryption to prevent corruption from stray newlines or carriage returns in pasted input.

func (*LiveClient) CreatePipelineSchedule added in v0.31.0

func (c *LiveClient) CreatePipelineSchedule(_ context.Context, owner, repo, ref, description, cron string, _ map[string]string) (int64, error)

CreatePipelineSchedule is not supported on GitHub.

func (*LiveClient) CreateProtectedCIVariable added in v0.31.0

func (c *LiveClient) CreateProtectedCIVariable(_ context.Context, _, _, _, _ string) error

CreateProtectedCIVariable is not supported on GitHub.

func (*LiveClient) CreatePullRequestReview added in v0.2.0

func (c *LiveClient) CreatePullRequestReview(ctx context.Context, owner, repo string, number int, event, body, commitSHA string, comments []forge.ReviewComment) error

CreatePullRequestReview submits a formal review on a pull request. The event must be one of: APPROVE, REQUEST_CHANGES, COMMENT. When commitSHA is non-empty it is sent as commit_id, pinning the review to that commit. GitHub rejects the request if the commit is not the PR's current HEAD, closing the TOCTOU gap between the stale-head check and review submission. When comments is non-nil, inline diff comments are attached to the review via the GitHub "comments" field.

func (*LiveClient) CreateRepo

func (c *LiveClient) CreateRepo(ctx context.Context, org, name, description string, private bool) (*forge.Repository, error)

CreateRepo creates a new repository under an organization.

The repo is created with auto_init: true so that a default branch exists immediately. However, GitHub's auto_init is asynchronous — the API returns 201 before the initial commit is fully materialized. Callers writing files to the new repo via the Contents API should expect transient 404s and retry with backoff. See the retry logic in LiveClient.do().

func (*LiveClient) CreateRepoSecret

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

CreateRepoSecret creates or updates an encrypted repository secret.

func (*LiveClient) DeleteFile added in v0.1.0

func (c *LiveClient) DeleteFile(ctx context.Context, owner, repo, path, message string) error

DeleteFile deletes a file from the repository's default branch. It first fetches the file to obtain its SHA (required by the GitHub Contents API), then issues the DELETE. Retries on transient 404/409 errors.

func (*LiveClient) DeleteFiles added in v0.19.0

func (c *LiveClient) DeleteFiles(ctx context.Context, owner, repo, message string, paths []string) (int, error)

DeleteFiles atomically removes paths from the repository default branch.

func (*LiveClient) DeleteIssueComment added in v0.15.0

func (c *LiveClient) DeleteIssueComment(ctx context.Context, owner, repo string, commentID int) error

DeleteIssueComment deletes an issue comment by its numeric ID.

func (*LiveClient) DeleteOrgSecret

func (c *LiveClient) DeleteOrgSecret(ctx context.Context, org, name string) error

DeleteOrgSecret deletes an org-level secret. It is idempotent: a 404 (secret already gone) is not treated as an error.

func (*LiveClient) DeleteOrgVariable added in v0.8.0

func (c *LiveClient) DeleteOrgVariable(ctx context.Context, org, name string) error

DeleteOrgVariable deletes an org-level variable. It is idempotent: a 404 (variable already gone) is not treated as an error.

func (*LiveClient) DeletePipelineSchedule added in v0.31.0

func (c *LiveClient) DeletePipelineSchedule(_ context.Context, owner, repo string, scheduleID int64) error

DeletePipelineSchedule is not supported on GitHub.

func (*LiveClient) DeleteRepo

func (c *LiveClient) DeleteRepo(ctx context.Context, owner, repo string) error

DeleteRepo deletes a repository.

func (*LiveClient) DeleteRepoSecret added in v0.28.0

func (c *LiveClient) DeleteRepoSecret(ctx context.Context, owner, repo, name string) error

DeleteRepoSecret deletes a repository Actions secret. It is idempotent: a 404 (secret already gone) is not treated as an error.

func (*LiveClient) DeleteRepoVariable added in v0.28.0

func (c *LiveClient) DeleteRepoVariable(ctx context.Context, owner, repo, name string) error

DeleteRepoVariable deletes a repository Actions variable. It is idempotent: a 404 (variable already gone) is not treated as an error.

func (*LiveClient) DismissPullRequestReview added in v0.6.0

func (c *LiveClient) DismissPullRequestReview(ctx context.Context, owner, repo string, number, reviewID int, message string) error

DismissPullRequestReview dismisses a review, changing its state to DISMISSED.

func (*LiveClient) DispatchWorkflow

func (c *LiveClient) DispatchWorkflow(ctx context.Context, owner, repo, workflowFile, ref string, inputs map[string]string) error

DispatchWorkflow triggers a workflow_dispatch event on a workflow file. GitHub returns 204 No Content on success (not 200 or 201).

func (*LiveClient) DownloadWorkflowRunArtifact added in v0.30.0

func (c *LiveClient) DownloadWorkflowRunArtifact(ctx context.Context, owner, repo string, artifactID int) ([]byte, error)

DownloadWorkflowRunArtifact returns the zip archive for a workflow artifact.

func (*LiveClient) FindExistingFork added in v0.24.0

func (c *LiveClient) FindExistingFork(ctx context.Context, owner, repo string) (string, string, error)

FindExistingFork checks whether the authenticated user already owns a fork of owner/repo by fetching GET /repos/{user}/{repo} and verifying the parent relationship. Returns the fork owner login and repo name if found, or empty strings when no fork exists. The repo name may differ from the upstream name when GitHub renamed it to avoid collisions. Only real API errors are returned as err.

func (*LiveClient) GetAppClientID added in v0.1.0

func (c *LiveClient) GetAppClientID(ctx context.Context, slug string) (string, error)

func (*LiveClient) GetAuthenticatedUser

func (c *LiveClient) GetAuthenticatedUser(ctx context.Context) (string, error)

GetAuthenticatedUser returns the login of the authenticated user.

For classic PATs and OAuth tokens the identity comes from GET /user. GitHub App JWTs fall back to GET /app and derive "{slug}[bot]". Installation access tokens cannot use either REST endpoint; those fall back to a GraphQL viewer query, which returns the bot login directly.

func (*LiveClient) GetAuthenticatedUserIdentity added in v0.19.0

func (c *LiveClient) GetAuthenticatedUserIdentity(ctx context.Context) (*forge.UserIdentity, error)

GetAuthenticatedUserIdentity returns the display name and email of the authenticated user by calling GET /user.

For classic PATs and OAuth tokens the endpoint returns the user's profile including name, email, and numeric ID. When name is empty, login is used as a fallback. When email is empty, the GitHub noreply address is constructed from the user's ID and login.

GitHub App installation tokens cannot call /user, so this method returns forge.ErrNotFound for those token types.

func (*LiveClient) GetBranchRef added in v0.25.0

func (c *LiveClient) GetBranchRef(ctx context.Context, owner, repo, branch string) (string, error)

GetBranchRef returns the HEAD commit SHA for the named branch.

func (*LiveClient) GetCollaboratorPermission added in v0.31.0

func (c *LiveClient) GetCollaboratorPermission(ctx context.Context, owner, repo, username string) (string, error)

func (*LiveClient) GetFileContent

func (c *LiveClient) GetFileContent(ctx context.Context, owner, repo, path string) ([]byte, error)

GetFileContent retrieves the content of a file from a repository.

func (*LiveClient) GetFileContentAtRef added in v0.17.0

func (c *LiveClient) GetFileContentAtRef(ctx context.Context, owner, repo, path, ref string) ([]byte, error)

GetFileContentAtRef retrieves the content of a file at a specific ref (commit SHA, branch, or tag). Unlike GetFileContent which reads from the default branch, this reads from the specified ref.

func (*LiveClient) GetIssue added in v0.30.0

func (c *LiveClient) GetIssue(ctx context.Context, owner, repo string, number int) (*forge.Issue, error)

GetIssue returns an issue by number.

func (*LiveClient) GetLatestWorkflowRun

func (c *LiveClient) GetLatestWorkflowRun(ctx context.Context, owner, repo, workflowFile string) (*forge.WorkflowRun, error)

GetLatestWorkflowRun returns the most recent workflow run for a workflow file.

func (*LiveClient) GetOrgPlan added in v0.8.0

func (c *LiveClient) GetOrgPlan(ctx context.Context, org string) (string, error)

GetOrgPlan returns the billing plan name for the org (e.g. "free", "team", "enterprise").

func (*LiveClient) GetOrgSecretRepos added in v0.5.0

func (c *LiveClient) GetOrgSecretRepos(ctx context.Context, org, name string) ([]int64, error)

GetOrgSecretRepos returns the repository IDs that have access to an org secret.

func (*LiveClient) GetOrgVariable added in v0.24.0

func (c *LiveClient) GetOrgVariable(ctx context.Context, org, name string) (string, bool, error)

GetOrgVariable reads an org-level Actions variable value.

func (*LiveClient) GetOrgVariableRepos added in v0.12.0

func (c *LiveClient) GetOrgVariableRepos(ctx context.Context, org, name string) ([]int64, error)

GetOrgVariableRepos returns the repository IDs that have access to an org variable.

func (*LiveClient) GetPullRequestHeadSHA added in v0.2.0

func (c *LiveClient) GetPullRequestHeadSHA(ctx context.Context, owner, repo string, number int) (string, error)

GetPullRequestHeadSHA returns the current HEAD commit SHA of a pull request.

func (*LiveClient) GetPullRequestInfo added in v0.31.0

func (c *LiveClient) GetPullRequestInfo(ctx context.Context, owner, repo string, number int) (*forge.PullRequestInfo, error)

GetPullRequestInfo returns branch/repo context for a pull request.

func (*LiveClient) GetRef added in v0.29.0

func (c *LiveClient) GetRef(ctx context.Context, owner, repo, refPath string) (string, error)

GetRef returns the commit SHA for the given ref path (e.g., "heads/main", "tags/v0").

func (*LiveClient) GetRepo

func (c *LiveClient) GetRepo(ctx context.Context, owner, repo string) (*forge.Repository, error)

GetRepo retrieves a single repository by owner and name. Returns forge.ErrNotFound (wrapped) if the repo does not exist.

func (*LiveClient) GetRepoVariable added in v0.8.0

func (c *LiveClient) GetRepoVariable(ctx context.Context, owner, repo, name string) (string, bool, error)

GetRepoVariable returns the value of a repository Actions variable. Returns ("", false, nil) if the variable does not exist.

func (*LiveClient) GetTokenScopes

func (c *LiveClient) GetTokenScopes(ctx context.Context) ([]string, error)

GetTokenScopes returns the OAuth scopes granted to the current token by inspecting the X-OAuth-Scopes header from a lightweight API call.

GitHub only populates X-OAuth-Scopes for classic PATs and OAuth tokens. Fine-grained PATs and GitHub App installation tokens return an empty header, making scope introspection impossible for those token types. There is no alternative API to query fine-grained PAT permissions. See: https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api#missing-or-incorrect-x-oauth-scopes-header

func (*LiveClient) GetWorkflow added in v0.19.0

func (c *LiveClient) GetWorkflow(ctx context.Context, owner, repo, workflowFile string) (*forge.Workflow, error)

GetWorkflow returns a workflow definition by filename (e.g. repo-maintenance.yml).

func (*LiveClient) GetWorkflowRun

func (c *LiveClient) GetWorkflowRun(ctx context.Context, owner, repo string, runID int) (*forge.WorkflowRun, error)

GetWorkflowRun returns a specific workflow run by ID.

func (*LiveClient) GetWorkflowRunAnnotations added in v0.13.0

func (c *LiveClient) GetWorkflowRunAnnotations(ctx context.Context, owner, repo string, runID int) ([]forge.Annotation, error)

GetWorkflowRunAnnotations returns annotations from all jobs in a workflow run. GitHub workflow commands (::notice::, ::warning::) produce check-run annotations that are accessible via the check-runs API.

func (*LiveClient) GetWorkflowRunLogs added in v0.0.3

func (c *LiveClient) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int) (string, error)

GetWorkflowRunLogs downloads the logs for a workflow run. It fetches the job list for the run and concatenates each job's log output.

func (*LiveClient) IsInstallationToken added in v0.24.0

func (c *LiveClient) IsInstallationToken(ctx context.Context) (bool, error)

IsInstallationToken reports whether the client's token is a GitHub App installation access token.

func (*LiveClient) IsProtectedBranch added in v0.31.0

func (c *LiveClient) IsProtectedBranch(ctx context.Context, owner, repo, branch string) (bool, error)

IsProtectedBranch checks whether the given branch has protection rules enabled on GitHub by querying the branch protection API endpoint. GitHub returns 404 both when a branch exists but is not protected and when the branch/repo does not exist. We distinguish the two by inspecting the API error message: "Branch not protected" means the branch exists but has no protection rules.

func (*LiveClient) ListDirectoryContents added in v0.17.0

func (c *LiveClient) ListDirectoryContents(ctx context.Context, owner, repo, path, ref string, recursive bool) ([]forge.DirectoryEntry, error)

ListDirectoryContents returns all files and subdirectories at the given path in a repository at the specified ref. When path points to a directory, the GitHub Contents API returns a JSON array of entries.

func (*LiveClient) ListIssueComments added in v0.0.4

func (c *LiveClient) ListIssueComments(ctx context.Context, owner, repo string, number int) ([]forge.IssueComment, error)

ListIssueComments returns all comments on an issue, paginating automatically.

func (*LiveClient) ListOpenIssues added in v0.8.0

func (c *LiveClient) ListOpenIssues(ctx context.Context, owner, repo string, labels ...string) ([]forge.Issue, error)

ListOpenIssues returns open issues on a repository, excluding pull requests. When labels are provided, GitHub filters to issues carrying those labels.

func (*LiveClient) ListOrgInstallations

func (c *LiveClient) ListOrgInstallations(ctx context.Context, org string) ([]forge.Installation, error)

ListOrgInstallations lists app installations for an organization.

func (*LiveClient) ListOrgRepos

func (c *LiveClient) ListOrgRepos(ctx context.Context, org string) ([]forge.Repository, error)

ListOrgRepos returns public, non-archived, non-fork repositories for an org.

Private repos are excluded because the default .fullsend config repo is public and agent workflow logs are visible to anyone. Enrolling a private repo would expose its code in those public logs.

Forks are excluded because fullsend's trust model assumes org-owned repos where CODEOWNERS governance and org-level permissions control agent autonomy. Fork repos may have different ownership and CODEOWNERS configs, which could bypass human-approval gates. Archived repos are excluded because they represent inactive targets where agent work would be wasted.

func (*LiveClient) ListOrgVariables added in v0.24.0

func (c *LiveClient) ListOrgVariables(ctx context.Context, org string) ([]forge.OrgVariable, error)

ListOrgVariables lists org-level Actions variables (paginated).

func (*LiveClient) ListPipelineSchedules added in v0.31.0

func (c *LiveClient) ListPipelineSchedules(_ context.Context, owner, repo string) ([]forge.PipelineSchedule, error)

ListPipelineSchedules is not supported on GitHub.

func (*LiveClient) ListPullRequestFileDiffs added in v0.11.0

func (c *LiveClient) ListPullRequestFileDiffs(ctx context.Context, owner, repo string, number int) ([]forge.PullRequestFileDiff, error)

ListPullRequestFileDiffs returns the files changed by a pull request along with their unified diff patches. Same API endpoint as ListPullRequestFiles but also extracts the patch field.

func (*LiveClient) ListPullRequestFiles added in v0.8.5

func (c *LiveClient) ListPullRequestFiles(ctx context.Context, owner, repo string, number int) ([]string, error)

ListPullRequestFiles returns the file paths changed by a pull request. GitHub caps PR file lists at 3000 files total regardless of pagination.

func (*LiveClient) ListPullRequestReviews added in v0.2.0

func (c *LiveClient) ListPullRequestReviews(ctx context.Context, owner, repo string, number int) ([]forge.PullRequestReview, error)

ListPullRequestReviews returns all reviews on a pull request, paginating automatically.

func (*LiveClient) ListRecentWorkflowRuns added in v0.30.0

func (c *LiveClient) ListRecentWorkflowRuns(ctx context.Context, owner, repo string, perPage int) ([]forge.WorkflowRun, error)

ListRecentWorkflowRuns returns recent workflow runs across all workflows.

func (*LiveClient) ListRepoPullRequests

func (c *LiveClient) ListRepoPullRequests(ctx context.Context, owner, repo string) ([]forge.ChangeProposal, error)

ListRepoPullRequests lists open pull requests for a repository with pagination.

func (*LiveClient) ListRepoVariables added in v0.28.0

func (c *LiveClient) ListRepoVariables(ctx context.Context, owner, repo string) (map[string]string, error)

ListRepoVariables returns all Actions variables for a repository as a name-to-value map. Results are paginated; the method follows pagination until all variables are fetched or the safety page cap is reached.

func (*LiveClient) ListRepositoryArtifacts added in v0.30.0

func (c *LiveClient) ListRepositoryArtifacts(ctx context.Context, owner, repo string, perPage int) ([]forge.RepositoryArtifact, error)

ListRepositoryArtifacts returns recent artifacts stored for a repository.

func (*LiveClient) ListRepositoryFiles added in v0.30.0

func (c *LiveClient) ListRepositoryFiles(ctx context.Context, owner, repo string) ([]string, error)

ListRepositoryFiles returns all file paths in the default branch using the Git Trees API (single recursive call).

func (*LiveClient) ListWorkflowRunArtifacts added in v0.30.0

func (c *LiveClient) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int) ([]forge.WorkflowArtifact, error)

ListWorkflowRunArtifacts returns artifacts uploaded by a workflow run.

func (*LiveClient) ListWorkflowRuns added in v0.0.3

func (c *LiveClient) ListWorkflowRuns(ctx context.Context, owner, repo, workflowFile string) ([]forge.WorkflowRun, error)

ListWorkflowRuns returns recent workflow runs for a workflow file.

func (*LiveClient) MergeChangeProposal added in v0.0.3

func (c *LiveClient) MergeChangeProposal(ctx context.Context, owner, repo string, number int) error

MergeChangeProposal squash-merges a pull request by number.

func (*LiveClient) MinimizeComment added in v0.2.0

func (c *LiveClient) MinimizeComment(ctx context.Context, nodeID, reason string) error

MinimizeComment minimizes (hides) an issue or review comment via the GitHub GraphQL API. The caller provides the GraphQL node ID directly (available in IssueComment.NodeID and PullRequestReview.NodeID). The reason must be one of: ABUSE, OFF_TOPIC, OUTDATED, RESOLVED, DUPLICATE, SPAM.

func (*LiveClient) OrgSecretExists

func (c *LiveClient) OrgSecretExists(ctx context.Context, org, name string) (bool, error)

OrgSecretExists checks if an org-level secret exists.

func (*LiveClient) OrgVariableExists added in v0.8.0

func (c *LiveClient) OrgVariableExists(ctx context.Context, org, name string) (bool, error)

OrgVariableExists checks if an org-level variable exists.

func (*LiveClient) RepoSecretExists

func (c *LiveClient) RepoSecretExists(ctx context.Context, owner, repo, name string) (bool, error)

RepoSecretExists checks if a secret exists in a repository.

func (*LiveClient) RepoVariableExists

func (c *LiveClient) RepoVariableExists(ctx context.Context, owner, repo, name string) (bool, error)

RepoVariableExists checks if a variable exists in a repository.

func (*LiveClient) SetOrgSecretRepos

func (c *LiveClient) SetOrgSecretRepos(ctx context.Context, org, name string, repoIDs []int64) error

SetOrgSecretRepos sets the list of repositories that can access an org secret.

func (*LiveClient) SetOrgVariableRepos added in v0.12.0

func (c *LiveClient) SetOrgVariableRepos(ctx context.Context, org, name string, repoIDs []int64) error

SetOrgVariableRepos sets the list of repositories that can access an org variable.

func (*LiveClient) UpdateCIVariable added in v0.31.0

func (c *LiveClient) UpdateCIVariable(_ context.Context, _, _, _, _ string, _ bool) error

UpdateCIVariable is not supported on GitHub.

func (*LiveClient) UpdateIssueComment added in v0.2.0

func (c *LiveClient) UpdateIssueComment(ctx context.Context, owner, repo string, commentID int, body string) error

UpdateIssueComment updates the body of an existing issue comment.

func (*LiveClient) UpdatePullRequestBranch added in v0.19.0

func (c *LiveClient) UpdatePullRequestBranch(ctx context.Context, owner, repo string, number int) error

UpdatePullRequestBranch updates a PR's head branch by merging the base branch into it (GitHub's PUT /repos/{owner}/{repo}/pulls/{number}/update-branch). The GitHub API returns 202 Accepted for this endpoint.

func (*LiveClient) WithBaseURL

func (c *LiveClient) WithBaseURL(url string) *LiveClient

WithBaseURL sets a custom base URL (for testing with httptest).

Jump to

Keyboard shortcuts

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