Ask0 logoAsk0
Sources

GitHub

Use GitHub issues, discussions, and wikis as knowledge sources. Sync repositories, pull requests, and markdown docs to your AI assistant.

Connect your GitHub repositories to use issues, discussions, pull requests, and wikis as knowledge sources. This is perfect for technical documentation, community support, and keeping your AI assistant updated with the latest project information.

What Can Be Indexed

Ask0 can index the following GitHub content:

  • Issues: Open and closed issues with comments
  • Discussions: Community Q&As and announcements
  • Pull Requests: PRs with descriptions and review comments
  • Wiki Pages: Repository wiki documentation
  • README Files: Main and folder READMEs
  • Documentation: Markdown files in docs folders
  • Releases: Release notes and changelogs

Setting Up GitHub Source

Generate GitHub Token

  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Click "Generate new token (classic)"
  3. Select scopes:
    • repo (for private repositories)
    • public_repo (for public repositories only)
    • read:discussion (for discussions)
  4. Copy the generated token

Add GitHub Source

In Ask0 dashboard:

  1. Navigate to SourcesAdd SourceGitHub
  2. Enter your GitHub token
  3. Configure repository settings

Configure Repository

Repository: owner/repo-name
Branch: main  # or master, develop, etc.

Content Types:
  ☑ Issues
  ☑ Discussions
  ☑ Pull Requests
  ☑ Wiki
  ☑ Documentation Files

Filters:
  Issue Labels: [bug, feature, documentation]
  Issue State: all  # open, closed, or all
  Discussion Categories: [Q&A, Announcements]
  File Paths:
    - /docs/**/*.md
    - /README.md
    - /wiki/**

Refresh Schedule: Every 6 hours

Start Indexing

Click "Connect & Index" to begin importing GitHub content.

Configuration Options

Repository Selection

Index single or multiple repositories:

repository: myorg/myrepo

repositories:
  - myorg/main-app
  - myorg/mobile-app
  - myorg/documentation

organization: myorg
include_repos: [main-*, docs-*]
exclude_repos: [*-archive, *-deprecated]

Content Filtering

Issues

issues:
  enabled: true
  states: [open, closed]
  labels:
    include: [documentation, faq, help-wanted]
    exclude: [wontfix, duplicate]
  created_after: 2023-01-01
  with_comments: true
  min_comments: 0
  assignees: [user1, user2]  # optional

Discussions

discussions:
  enabled: true
  categories:
    include: [Q&A, How-to, Show and Tell]
    exclude: [Polls]
  answered_only: false
  include_comments: true

Pull Requests

pull_requests:
  enabled: true
  states: [open, closed, merged]
  include_drafts: false
  include_reviews: true
  include_comments: true
  base_branch: main

Documentation Files

files:
  enabled: true
  paths:
    include:
      - /**/*.md
      - /**/*.mdx
      - /**/README*
    exclude:
      - /**/node_modules/**
      - /**/vendor/**
      - /**/.github/**
  max_file_size: 10MB

Advanced Configuration

Authentication

For different access needs:

auth_type: token
token: ghp_xxxxxxxxxxxx
auth_type: app
app_id: 123456
private_key: |
  -----BEGIN RSA PRIVATE KEY-----
  ...
  -----END RSA PRIVATE KEY-----
installation_id: 789012
auth_type: oauth
client_id: your_client_id
client_secret: your_client_secret
access_token: your_access_token

Rate Limiting

Respect GitHub API limits:

rate_limiting:
  requests_per_hour: 5000  # GitHub default
  concurrent_requests: 10
  retry_after_rate_limit: true
  backoff_strategy: exponential

Incremental Updates

Efficiently update only changed content:

incremental:
  enabled: true
  strategy: since_last_sync
  check_interval: 1 hour
  webhooks:
    enabled: true
    secret: your_webhook_secret
    events: [issues, discussion, push]

Webhook Integration

Set up real-time updates:

  1. In Ask0: Get your webhook URL from source settings
  2. In GitHub: Add webhook in repository settings
  3. Configure events:
    • Issues
    • Discussions
    • Pull requests
    • Pushes (for documentation)
    • Wiki changes
Webhook URL: https://api.ask0.ai/webhooks/github/YOUR_SOURCE_ID
Content Type: application/json
Secret: your_webhook_secret
Events:
  ☑ Issues
  ☑ Discussion
  ☑ Pull request
  ☑ Push
  ☑ Wiki

Content Processing

Issue Enhancement

Automatically enrich issue content:

issue_processing:
  include_metadata: true
  extract_code_blocks: true
  link_related_issues: true
  include_labels_in_content: true
  format: markdown

Code Block Handling

Process code examples:

code_handling:
  extract_language: true
  syntax_highlight: false  # for indexing
  include_line_numbers: false
  max_lines_per_block: 100

Convert GitHub references:

link_resolution:
  convert_issue_refs: true  # #123 → full link
  convert_user_mentions: true  # @user → profile link
  convert_commit_shas: true  # abc123 → commit link
  resolve_relative_links: true

Best Practices

Optimizing GitHub Sources:

  1. Use labels to categorize and filter content
  2. Encourage detailed issue descriptions
  3. Maintain a comprehensive wiki
  4. Use discussion categories effectively
  5. Keep README files updated

Labeling Strategy

Create a labeling system for better indexing:

Labels for Indexing:
  - "documentation": Always index
  - "faq": High priority
  - "bug": Include with context
  - "feature-request": Include for roadmap
  - "internal": Exclude from public
  - "duplicate": Always exclude

Content Quality

Improve answer quality:

  • Write descriptive issue titles
  • Include reproduction steps
  • Add solution in comments when resolved
  • Use discussions for Q&A
  • Maintain up-to-date documentation

Monitoring

Sync Status

Track indexing progress:

Repository: myorg/myrepo
Last Sync: 2024-01-15 14:30:00
Status: Active
Statistics:
  - Issues: 234 indexed
  - Discussions: 89 indexed
  - Files: 156 indexed
  - Total Tokens: 1.2M
Next Sync: 2024-01-15 20:30:00

Common Issues

Authentication Failed

  • Verify token has correct scopes
  • Check token expiration
  • Ensure repository access

Rate Limit Exceeded

  • Reduce sync frequency
  • Lower concurrent requests
  • Use webhook updates instead

Missing Content

  • Check filter configuration
  • Verify file paths
  • Review label filters

API Usage

Manage GitHub sources programmatically:

// Create GitHub source
const source = await ask0.sources.create({
  type: 'github',
  name: 'Main Repository',
  config: {
    repository: 'myorg/myrepo',
    token: process.env.GITHUB_TOKEN,
    contentTypes: ['issues', 'discussions', 'files'],
    filters: {
      issues: {
        labels: ['documentation', 'faq'],
        states: ['open', 'closed']
      }
    }
  }
});

// Trigger sync
await ask0.sources.sync(source.id);

// Get indexed content stats
const stats = await ask0.sources.getStats(source.id);
console.log(`Indexed ${stats.issues} issues, ${stats.discussions} discussions`);

// Search within GitHub source
const results = await ask0.search({
  query: 'authentication error',
  sources: [source.id],
  limit: 10
});

Security Considerations

Token Management

  • Store tokens securely (use environment variables)
  • Rotate tokens regularly
  • Use minimum required scopes
  • Monitor token usage

Private Repositories

When indexing private repos:

privacy:
  respect_visibility: true
  exclude_sensitive_labels: [security, private]
  redact_emails: true
  mask_tokens: true

Next Steps