> ## 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.

# GitLab Integration

> Connect InitRepo with GitLab for comprehensive project documentation

# GitLab Integration

Integrate InitRepo with GitLab to leverage your existing GitLab workflows for documentation generation.

## Features

* **Project Analysis**: Deep analysis of GitLab projects and repositories
* **Merge Request Documentation**: Automatic documentation from merge requests
* **CI/CD Integration**: Seamless integration with GitLab CI/CD pipelines
* **Group Management**: Handle multiple projects within GitLab groups

## Setup

<Steps>
  <Step title="Connect GitLab Account">
    1. Access your [InitRepo dashboard](https://www.initrepo.com)
    2. Go to Integrations → GitLab
    3. Click "Connect GitLab"
    4. Authorize InitRepo to access your GitLab account
  </Step>

  <Step title="Select Projects">
    Choose which GitLab projects to analyze:

    * Individual repositories
    * Group projects
    * Subgroups and nested projects
  </Step>

  <Step title="Configure CI/CD">
    Add InitRepo to your GitLab CI/CD pipeline:

    ```yaml theme={null}
    stages:
      - build
      - docs

    generate_docs:
      stage: docs
      script:
        - initrepo analyze --gitlab-project $CI_PROJECT_ID
      only:
        - main
        - develop
    ```
  </Step>
</Steps>

## Webhook Configuration

Set up webhooks for automatic documentation updates:

```json theme={null}
{
  "url": "https://api.initrepo.com/webhooks/gitlab",
  "push_events": true,
  "merge_requests_events": true,
  "tag_push_events": true
}
```

## API Usage

```javascript theme={null}
const gitlabAnalysis = await fetch('/api/gitlab/projects/analyze', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.INITREPO_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    projectId: 12345,
    documentationTypes: ['architecture', 'api', 'deployment']
  })
});
```
