Adapter

GitHub

Overview

Adapter for a GitHub repository. Object operations go through the Contents API; snapshots and forks are first-class git refs — every snapshot is a tag and every fork is a branch.

Configuration

import { Storage } from '@storagesdk/core';
import { github } from '@storagesdk/adapters/github';

const storage = new Storage({
  adapter: github({
    owner: 'storagesdk',
    repo: 'agent-artifacts',
    // branch defaults to the repo's default branch
    // token defaults to process.env.GITHUB_TOKEN
  }),
});
github({
  owner: string;
  repo: string;
  branch?: string;     // defaults to the repo's default branch
  token?: string;      // GITHUB_TOKEN env if omitted
  baseUrl?: string;    // GitHub Enterprise
  commitMessage?: (op, paths) => string;
});

No bucket field — the storage namespace is (owner, repo, branch). Snapshots and forks are addressed by tag and branch name respectively.

Generate a token in the GitHub UI: Settings → Developer settings → Personal access tokens. Fine-grained tokens need Contents: Read and write on the target repo; classic tokens need the repo scope. See GitHub’s docs on managing personal access tokens.

Notes

Compatibility

CapabilitySupport
SnapshotsNative — git tag at refs/tags/<id>
ForksNative — git branch at refs/heads/<name>
Byte-range reads✓ (slice of the downloaded blob)
Multipart upload
Enforced upload limits
User metadata
Signed URLs✓ — raw.githubusercontent.com (public repos only)