Skip to main content

GitHub Integration

Integrate InitRepo with GitHub to automatically generate documentation from your repositories and pull requests.

Features

  • Repository Analysis: Automatically analyze GitHub repositories
  • PR Documentation: Generate documentation from pull requests
  • Webhook Integration: Real-time updates when code changes
  • GitHub Actions: Automate documentation generation in CI/CD

Setup

1

Connect Repository

  1. Go to your InitRepo dashboard
  2. Navigate to Integrations → GitHub
  3. Click “Connect Repository”
  4. Select the repository you want to analyze
2

Configure Webhooks

Set up webhooks to automatically update documentation when:
  • New pull requests are created
  • Code is pushed to main branch
  • Issues are updated
3

Generate Documentation

Use GitHub Actions to automatically generate documentation:
name: Generate Documentation
on: [push, pull_request]

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
      - uses: initrepo/docs-action@v1
        with:
          repository: ${{ github.repository }}

API Integration

Use the GitHub API to programmatically generate documentation:
const response = await fetch('/api/github/analyze', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.INITREPO_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    repository: 'owner/repo',
    generateTypes: ['architecture', 'api', 'readme']
  })
});