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:

allowedPaths: ['docs/**', 'examples/**']

Exclude patterns:

excludedPaths: ['node_modules/**', '*.lock', '.git/**']

File type filtering:

allowedPaths: ['**/*.md', '**/*.ts']

What Gets Synced

  • Source code files

  • Documentation files

  • README and configuration files

  • File metadata (path, size, modified date)

  • Git metadata (commit hash, author)


Use Cases

Documentation Sync:

repositoryOwner: 'facebook',
repositoryName: 'react',
allowedPaths: ['docs/**']

Code Search:

repositoryOwner: 'vercel',
repositoryName: 'next.js',
allowedPaths: ['**/*.ts', '**/*.tsx']

Examples Library:

repositoryOwner: 'graphlit',
repositoryName: 'graphlit-samples',
allowedPaths: ['python/**', 'nextjs/**']

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

Was this helpful?