# GitLab CI/CD

Max Prilutskiy·Updated 2 months ago·2 min read

The Lingo.dev GitLab integration runs the localization pipeline using the `ci` command inside the official Docker image. It commits translations directly or creates merge requests depending on your workflow.

## Prerequisites

Complete the [CI/CD Setup](/content/en/docs/integrations/setup/index.html) first. You need a working `i18n.json` and both `LINGODOTDEV_API_KEY` and `GL_TOKEN` stored as CI/CD variables.

## Access tokens

GitLab requires an access token for git operations in pipelines. Either a personal access token or project access token works:

### Personal access token

1. Select your avatar > **Edit profile** > **Access tokens**  
2. Click **Add new token**, name it (e.g., "Lingo.dev")  
3. Enable scopes: `api`, `read_repository`, `write_repository`  
4. Click **Create personal access token**

Store the token as a CI/CD variable named `GL_TOKEN` ( **Settings > CI/CD > Variables**, select **Masked**).

## Pipeline examples

### Commit to main

```yaml
image:
  name: lingodotdev/ci-action:latest
  entrypoint: [""]

stages: [translate]

translate:
  stage: translate
  script:
    - npx lingo.dev@latest ci --api-key "$LINGODOTDEV_API_KEY"
  only:
    - main
```

### Merge request from main

```yaml
image:
  name: lingodotdev/ci-action:latest
  entrypoint: [""]

stages: [translate]

translate:
  stage: translate
  script:
    - npx lingo.dev@latest ci --pull-request --api-key "$LINGODOTDEV_API_KEY"
  only:
    - main
```

### Commit to feature branch

```yaml
image:
  name: lingodotdev/ci-action:latest
  entrypoint: [""]

stages: [translate]

translate:
  stage: translate
  script:
    - npx lingo.dev@latest ci --api-key "$LINGODOTDEV_API_KEY"
  only:
    - branches
  except:
    - main
```

### Merge request from feature branch

```yaml
image:
  name: lingodotdev/ci-action:latest
  entrypoint: [""]

stages: [translate]

translate:
  stage: translate
  script:
    - npx lingo.dev@latest ci --pull-request --api-key "$LINGODOTDEV_API_KEY"
  except:
    - main
```

## Customization

Override defaults using CLI flags:

```bash
npx lingo.dev@latest ci --api-key "$LINGODOTDEV_API_KEY" --commit-message "chore: update translations"
```

## Next Steps

[GitHub Actions

Set up GitHub Actions integration](/content/en/docs/integrations/github/index.html) [Bitbucket Pipelines

Set up Bitbucket Pipelines integration](/content/en/docs/integrations/bitbucket/index.html) [Advanced Patterns

Translation checks, merge conflicts, workflow selection](/content/en/docs/integrations/advanced/index.html) [Connect Your Engine

Route CI/CD translations through your engine](/content/en/docs/platform/connect-your-engine/index.html)
