Skip to main content

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

1

Connect GitLab Account

  1. Access your InitRepo dashboard
  2. Go to Integrations → GitLab
  3. Click “Connect GitLab”
  4. Authorize InitRepo to access your GitLab account
2

Select Projects

Choose which GitLab projects to analyze:
  • Individual repositories
  • Group projects
  • Subgroups and nested projects
3

Configure CI/CD

Add InitRepo to your GitLab CI/CD pipeline:
stages:
  - build
  - docs

generate_docs:
  stage: docs
  script:
    - initrepo analyze --gitlab-project $CI_PROJECT_ID
  only:
    - main
    - develop

Webhook Configuration

Set up webhooks for automatic documentation updates:
{
  "url": "https://api.initrepo.com/webhooks/gitlab",
  "push_events": true,
  "merge_requests_events": true,
  "tag_push_events": true
}

API Usage

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']
  })
});