Create GitHub Repository Feed

User Intent

"How do I sync files from a GitHub repository? Show me GitHub repo feed configuration."

Operation

SDK Method: createFeed() with FeedTypes.Site Auth: GitHub personal access token or OAuth


Code Example (TypeScript)

import { Graphlit } from 'graphlit-client';
import { FeedTypes, FeedServiceTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const feed = await graphlit.createFeed({
  name: 'GraphQL Docs',
  type: FeedTypes.Site,
  site: {
    type: FeedServiceTypes.GitHub,
    github: {
      repositoryOwner: 'graphql',
      repositoryName: 'graphql-spec',
      personalAccessToken: process.env.GITHUB_TOKEN!,
    },
    allowedPaths: ['spec/**', 'README.md'],
    readLimit: 1000,
  },
  // Optional: add workflow for content processing
  // workflow: { id: workflow.createWorkflow.id }
});

console.log(`Created GitHub repo feed: ${feed.createFeed.id}`);

Configuration

repositoryOwner: GitHub username or organization repositoryName: Repository name personalAccessToken: GitHub PAT allowedPaths: Array of path patterns to include excludedPaths: Array of path patterns to exclude readLimit: Maximum files to sync


Path Filtering

Include specific directories:

Exclude patterns:

File type filtering:


What Gets Synced

  • Repository files (source code, docs, READMEs, configuration files)

  • File metadata (path, size, modified date)

This feed does not sync GitHub Issues, Pull Requests, or Commits. Use the dedicated GitHub issue/PR/commit feeds for those.


How Updates Work

  • After the initial sync, the feed polls and ingests new or changed files.

  • Unchanged files are not reprocessed on every poll.

  • If you need deletions to be reflected, configure the feed syncMode to MIRROR.


Cost and Scope Controls

To avoid unexpectedly large backfills:

  • Start with narrow allowedPaths (and expand later).

  • Use excludedPaths to skip large folders and build output.

  • Keep readLimit conservative.

  • Avoid binaries and large assets when possible.

To monitor usage, see: Query Project Usage.


Use Cases

Documentation Sync:

Code Search:

Examples Library:


Private vs Public Repos

Public Repos:

  • Can use token with public_repo scope

  • No special permissions needed

Private Repos:

  • Requires token with full repo scope

  • Must have repository access


Last updated