> ## Documentation Index
> Fetch the complete documentation index at: https://docs.initrepo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Integration

> Connect InitRepo with GitHub for seamless project documentation

# 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

<Steps>
  <Step title="Connect Repository">
    1. Go to your [InitRepo dashboard](https://www.initrepo.com)
    2. Navigate to Integrations → GitHub
    3. Click "Connect Repository"
    4. Select the repository you want to analyze
  </Step>

  <Step title="Configure Webhooks">
    Set up webhooks to automatically update documentation when:

    * New pull requests are created
    * Code is pushed to main branch
    * Issues are updated
  </Step>

  <Step title="Generate Documentation">
    Use GitHub Actions to automatically generate documentation:

    ```yaml theme={null}
    name: Generate Documentation
    on: [push, pull_request]

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

## API Integration

Use the GitHub API to programmatically generate documentation:

```javascript theme={null}
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']
  })
});
```
