Class OrganizationResource

Represents a GitHub organization resource with chainable async methods.

Implements PromiseLike<GitHubOrganization> so it can be awaited directly to fetch the organization info, while also exposing sub-resource methods.

// Await directly to get organization info
const org = await gh.org('github');

// Get repositories
const repos = await gh.org('github').repos({ type: 'public', per_page: 50 });

// Navigate into a specific repository
const prs = await gh.org('github').repo('linguist').pullRequests({ state: 'open' });

// Get members
const members = await gh.org('github').members({ role: 'admin' });

Implements

Methods

  • Creates a new repository in this organization.

    POST /orgs/{org}/repos

    Parameters

    • data: CreateOrgRepoData

      Repository creation options. name is required.

    • Optionalsignal: AbortSignal

    Returns Promise<GitHubRepository>

    The newly created repository

    const repo = await gh.org('my-org').createRepo({
    name: 'my-new-repo',
    description: 'My new repository',
    private: true,
    auto_init: true,
    });
  • Returns a RepositoryResource for a given repository name within this organization.

    The returned resource can be awaited directly to fetch repository info, or chained to access nested resources.

    Parameters

    • name: string

      The repository name (e.g., 'linguist')

    Returns RepositoryResource

    A chainable repository resource

    const repo    = await gh.org('github').repo('linguist');
    const prs = await gh.org('github').repo('linguist').pullRequests({ state: 'open' });
    const commits = await gh.org('github').repo('linguist').commits({ per_page: 10 });