FabricFabricSDK
Plugins

GitHub

Manage repositories, issues, and pull requests via the GitHub API.

Authentication

TypeDefaultDetails
api_keyPersonal Access Token (ghp_... or classic PAT)
oauth_2GitHub OAuth App or GitHub App token

Both PATs and OAuth tokens ship as Authorization: Bearer <token>. The handler doesn't need to distinguish.

Endpoints

PathRiskDescription
repos.getreadGet a repository's metadata.
repos.listreadList repositories accessible to the user.
issues.listreadList issues in a repository.
issues.getreadGet a single issue.
issues.createwriteOpen a new issue.
issues.commentwriteComment on an issue or pull request.
pullRequests.listreadList pull requests.
pullRequests.getreadGet a pull request.
pullRequests.mergedestructiveMerge a pull request.

repos.get

Get a repository's metadata.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name

Output: GithubRepo

repos.list

List repositories accessible to the authenticated user.

Input:

FieldTypeDescription
per_pagenumberResults per page
pagenumberPage number

Output: GithubRepo[]

issues.list

List issues in a repository.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
statestringopen, closed, or all
per_pagenumberResults per page

Output: GithubIssue[]

issues.get

Get a single issue.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
issue_numbernumberIssue number

Output: GithubIssue

issues.create

Create a new issue.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
titlestringIssue title
bodystringIssue body (Markdown)
labelsstring[]Label names

Output: GithubIssue

issues.comment

Add a comment to an issue or pull request.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
issue_numbernumberIssue/PR number
bodystringComment body

Output: { id: number; body: string }

pullRequests.list

List pull requests in a repository.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
statestringopen, closed, all

Output: GithubPullRequest[]

pullRequests.get

Get a single pull request.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
pull_numbernumberPR number

Output: GithubPullRequest

pullRequests.merge

Merge a pull request.

Input:

FieldTypeRequiredDescription
ownerstringRepository owner
repostringRepository name
pull_numbernumberPR number
merge_methodenummerge, squash, or rebase (default: merge)

Output: { merged: boolean; sha: string }

Usage

import { createFabric } from "@fabricorg/integrations";
import { github } from "@fabricorg/integrations/plugins";

const fabric = createFabric({
  plugins: [
    github({ authType: "api_key", token: process.env.GITHUB_TOKEN }),
  ],
});

// List repos
const repos = await fabric.github.api.repos.list({ per_page: 10 });

// Create an issue
const issue = await fabric.github.api.issues.create({
  owner: "fabricorg",
  repo: "integrations",
  title: "Bug: timeout on large payloads",
  body: "## Steps to reproduce\n...",
  labels: ["bug", "p1"],
});

// Merge a PR
const result = await fabric.github.api.pullRequests.merge({
  owner: "fabricorg",
  repo: "integrations",
  pull_number: 42,
  merge_method: "squash",
});

Webhooks

GitHub webhooks are not yet implemented in this plugin. Phase 6 will add support for push, pull_request, issues, and workflow_run events.

Types

interface GithubRepo {
  id: number;
  full_name: string;
  private: boolean;
  default_branch: string;
}

interface GithubIssue {
  id: number;
  number: number;
  title: string;
  state: string;
  body: string | null;
  html_url: string;
}

interface GithubPullRequest {
  id: number;
  number: number;
  title: string;
  state: string;
  merged: boolean;
  head: { ref: string; sha: string };
  base: { ref: string };
}