Adds a collaborator to this repository.
PUT /repos/{owner}/{repo}/collaborators/{username}
Sends an invitation if the user is not yet a collaborator, or updates
their permission level if they already are. Returns void in both cases.
The GitHub login of the user to add
Optionaldata: AddCollaboratorDataOptional permission level (defaults to 'push')
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Fetches a specific branch by name.
GET /repos/{owner}/{repo}/branches/{branch}
The branch name (e.g., 'main')
Optionalsignal: AbortSignalThe branch object
Fetches branches for this repository.
GET /repos/{owner}/{repo}/branches
Optionalparams: BranchesParamsOptional filters: protected, per_page, page
Optionalsignal: AbortSignalA paged response of branches
Cancels a workflow run in progress.
POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel
The workflow run ID to cancel
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Lists collaborators for this repository.
GET /repos/{owner}/{repo}/collaborators
Optionalparams: CollaboratorsParamsOptional filters: affiliation, permission, per_page, page
Optionalsignal: AbortSignalA paged response of users who are collaborators
Returns a CommitResource for a given commit ref (SHA, branch, or tag).
Commit SHA, branch name, or tag name
A chainable commit resource
Fetches commits for this repository.
GET /repos/{owner}/{repo}/commits
Optionalparams: CommitsParamsOptional filters: sha, path, author, since, until, per_page, page
Optionalsignal: AbortSignalA paged response of commits
Fetches the contents of a file or directory in this repository.
GET /repos/{owner}/{repo}/contents/{path}
Returns a single GitHubContent for files, or an array for directories.
Optionalpath: stringPath to the file or directory. Omit for root.
Optionalparams: ContentParamsOptional: ref (branch, tag, or commit SHA)
Optionalsignal: AbortSignalFetches contributors to this repository.
GET /repos/{owner}/{repo}/contributors
Optionalparams: PaginationParams & { anon?: boolean }Optional filters: anon, per_page, page
Optionalsignal: AbortSignalCreates a draft security advisory in this repository.
POST /repos/{owner}/{repo}/security-advisories
Advisory data. summary and description are required.
Optionalsignal: AbortSignalThe created advisory draft
Creates a fork of this repository.
POST /repos/{owner}/{repo}/forks
Note: Forking is asynchronous on GitHub's side. The returned repository may not be fully ready immediately after this call returns.
Optionaldata: CreateForkDataOptional: target organization, custom name, default-branch-only flag
Optionalsignal: AbortSignalThe newly created fork
Creates an issue in this repository.
POST /repos/{owner}/{repo}/issues
Issue data. title is required.
Optionalsignal: AbortSignalThe created issue
Creates a label in this repository.
POST /repos/{owner}/{repo}/labels
Label data: name and color are required
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The created label
Creates a milestone in this repository.
POST /repos/{owner}/{repo}/milestones
Milestone data: title is required
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The created milestone
Creates a new release.
POST /repos/{owner}/{repo}/releases
Release data: tag_name (required), name, body, draft, prerelease, target_commitish
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The created release
Creates a webhook on this repository.
POST /repos/{owner}/{repo}/hooks
Webhook configuration. config.url is required.
Optionalsignal: AbortSignalThe created webhook
Deletes a label.
DELETE /repos/{owner}/{repo}/labels/{name}
The label name to delete
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Deletes a milestone.
DELETE /repos/{owner}/{repo}/milestones/{milestone_number}
The milestone number to delete
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Deletes a release.
DELETE /repos/{owner}/{repo}/releases/{release_id}
The release ID to delete
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Fetches the forks of this repository.
GET /repos/{owner}/{repo}/forks
Optionalparams: ForksParamsOptional filters: sort, per_page, page
Optionalsignal: AbortSignalA paged response of forked repositories
Fetches the repository details.
GET /repos/{owner}/{repo}
Optionalsignal: AbortSignalThe repository object
Fetches a git tree for this repository.
GET /repos/{owner}/{repo}/git/trees/{tree_sha}
The treeSha parameter accepts a tree SHA, a branch name, or a tag name.
Tree SHA, branch name (e.g. 'main'), or tag name
Optionalparams: GitTreeParamsOptional: recursive: '1' to fetch the full tree recursively
Optionalsignal: AbortSignalThe tree object with its entries
// Get the tree of the 'main' branch
const tree = await gh.repo('octocat', 'Hello-World').gitTree('main');
// Get the full recursive tree for a specific SHA
const fullTree = await gh.repo('octocat', 'Hello-World').gitTree('abc123', { recursive: '1' });
console.log(fullTree.tree.map(item => item.path));
Returns an IssueResource for a given issue number.
The returned resource can be awaited directly to fetch issue info, or chained to access sub-resources (comments).
The issue number within the repository
A chainable issue resource
Fetches issues for this repository.
GET /repos/{owner}/{repo}/issues
Note: GitHub returns pull requests as issues in this endpoint.
Filter them out by checking for the absence of pull_request.
Optionalparams: IssuesParamsOptional filters: state, labels, sort, direction, since, per_page, page
Optionalsignal: AbortSignalA paged response of issues
Fetches a single label by name.
GET /repos/{owner}/{repo}/labels/{name}
The label name
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The label object
Lists labels for this repository.
GET /repos/{owner}/{repo}/labels
Optionalparams: PaginationParamsOptional pagination: per_page, page
Optionalsignal: AbortSignalA paged response of labels
Returns the programming languages used in the repository and the number of bytes of code written in each language.
GET /repos/{owner}/{repo}/languages
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Object mapping language names to byte counts
Fetches the latest published release for this repository.
GET /repos/{owner}/{repo}/releases/latest
Optionalsignal: AbortSignalThe latest release object
Fetches a single milestone by number.
GET /repos/{owner}/{repo}/milestones/{milestone_number}
The milestone number
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The milestone object
Lists milestones for this repository.
GET /repos/{owner}/{repo}/milestones
Optionalparams: MilestonesParamsOptional filters: state, sort, direction, per_page, page
Optionalsignal: AbortSignalA paged response of milestones
Fetches the raw text content of multiple files in this repository.
Uses Accept: application/vnd.github.raw+json for each file request.
Files are fetched concurrently. If an individual file request fails, that file is omitted from the returned record and the remaining files are still returned.
Paths to the files (e.g., ['README.md', 'src/index.ts'])
Optionalparams: ContentParamsOptional: ref (branch, tag, or commit SHA)
Optionalsignal: AbortSignalA record mapping each fetched file path to its raw content
Returns a PullRequestResource for a given pull request number.
The pull request number (not the ID)
A chainable pull request resource
Fetches pull requests for this repository.
GET /repos/{owner}/{repo}/pulls
Optionalparams: PullRequestsParamsOptional filters: state, head, base, sort, direction, per_page, page
Optionalsignal: AbortSignalA paged response of pull requests
Fetches the raw text content of a file in this repository.
Uses Accept: application/vnd.github.raw+json.
GET /repos/{owner}/{repo}/contents/{filePath}
Path to the file (e.g., 'src/index.ts')
Optionalparams: ContentParamsOptional: ref (branch, tag, or commit SHA)
Optionalsignal: AbortSignalThe raw file content as a string
Fetches a single release by its numeric ID.
GET /repos/{owner}/{repo}/releases/{release_id}
The release ID
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The release object
Fetches releases for this repository.
GET /repos/{owner}/{repo}/releases
Optionalparams: PaginationParamsOptional pagination: per_page, page
Optionalsignal: AbortSignalA paged response of releases
Removes a collaborator from this repository.
DELETE /repos/{owner}/{repo}/collaborators/{username}
The GitHub login of the user to remove
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Lists security advisories for this repository.
GET /repos/{owner}/{repo}/security-advisories
Optionalparams: RepoAdvisoriesParamsOptional filters: direction, sort, state, per_page, page
Optionalsignal: AbortSignalA paged response of repository advisories
Fetches a single repository security advisory by its GHSA ID.
GET /repos/{owner}/{repo}/security-advisories/{ghsa_id}
The GHSA identifier (e.g., 'GHSA-xxxx-xxxx-xxxx')
Optionalsignal: AbortSignalThe repository advisory object
Requests a CVE ID for a repository security advisory.
POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve
The GHSA identifier
Optionalsignal: AbortSignalThe updated advisory with the CVE request submitted
Fetches tags for this repository.
GET /repos/{owner}/{repo}/tags
Optionalparams: PaginationParamsOptional pagination: per_page, page
Optionalsignal: AbortSignalA paged response of tags
Allows the resource to be awaited directly, resolving with the repository info. Delegates to RepositoryResource.get.
Optionalonfulfilled: null | (value: GitHubRepository) => TResult1 | PromiseLike<TResult1>Optionalonrejected: null | (reason: unknown) => TResult2 | PromiseLike<TResult2>Fetches the repository topics.
GET /repos/{owner}/{repo}/topics
Optionalsignal: AbortSignalAn array of topic strings
Triggers a workflow dispatch event.
POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches
The workflow ID (number) or file name (e.g., 'ci.yml')
Dispatch data: ref is required; inputs are optional
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
Updates a repository security advisory.
PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id}
The GHSA identifier
Fields to update
Optionalsignal: AbortSignalThe updated advisory
Updates a label.
PATCH /repos/{owner}/{repo}/labels/{name}
The current label name
Fields to update: name, color, description
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The updated label
Updates a milestone.
PATCH /repos/{owner}/{repo}/milestones/{milestone_number}
The milestone number to update
Fields to update: title, state, description, due_on
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The updated milestone
Updates an existing release.
PATCH /repos/{owner}/{repo}/releases/{release_id}
The release ID to update
Fields to update: tag_name, name, body, draft, prerelease
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The updated release
Updates an existing webhook on this repository.
PATCH /repos/{owner}/{repo}/hooks/{hook_id}
The webhook ID
Fields to update
Optionalsignal: AbortSignalThe updated webhook
Fetches webhooks configured on this repository.
GET /repos/{owner}/{repo}/hooks
Optionalparams: PaginationParamsOptional pagination: per_page, page
Optionalsignal: AbortSignalA paged response of webhooks
Fetches a single workflow run by its ID.
GET /repos/{owner}/{repo}/actions/runs/{run_id}
The workflow run ID
Optionalsignal: AbortSignalOptional AbortSignal to cancel the request
The workflow run object
Lists workflow runs for this repository.
GET /repos/{owner}/{repo}/actions/runs
Returns the raw GitHub Actions response envelope including total_count
and the workflow_runs array. Use params.per_page to limit how many
runs are fetched (default GitHub: 30, max: 100).
Optionalparams: WorkflowRunsParamsOptional filters: branch, event, status, actor, created, per_page, page
Optionalsignal: AbortSignalResponse envelope with total_count and workflow_runs
Lists workflows defined in this repository.
GET /repos/{owner}/{repo}/actions/workflows
Optionalparams: PaginationParamsOptional pagination: per_page, page
Optionalsignal: AbortSignalResponse envelope with total_count and workflows
Represents a GitHub repository resource with chainable async methods.
Implements
PromiseLike<GitHubRepository>so it can be awaited directly to fetch repository info, while also exposing sub-resource methods.Example