Skip to content

GitLab CI/CD Integration

← Back to CI/CD Overview

Quick Setup

Add Lingo.dev to your GitLab pipeline by including this in your .gitlab-ci.yml file:

yaml
lingodotdev:
  image: lingodotdev/ci-action:latest
  script:
    - echo "Done"

Required Environment Variables

Configure these in your repository under Settings → CI/CD → Variables:

  1. LINGODOTDEV_API_KEY - Your Lingo.dev API key
  2. GL_TOKEN - A GitLab access token with these scopes:
    • api
    • read_repository
    • write_repository

Important: The default CI job token is not sufficient. You must create a custom access token in Settings → Access tokens → Add new token.

Note: For protected branches, make sure your variables are also marked as protected. Unprotected variables won't be accessible in protected branch pipelines.

Pull Request Mode

Enable pull request creation instead of direct commits:

yaml
lingodotdev:
  image: lingodotdev/ci-action:latest
  variables:
    LINGODOTDEV_PULL_REQUEST: "true"
  script:
    - echo "Done"

Complete Pipeline Example

This example automatically translates content when pushing to feature branches:

yaml
lingodotdev:
  image: lingodotdev/ci-action:latest
  script:
    - echo "Done"
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH = /^feat/

How the Integration Works

The GitLab integration follows this process:

  1. Runs the translation engine to detect and translate new content
  2. Stages all translation changes
  3. Either commits directly to your branch or creates a merge request
  4. Handles conflicts automatically through rebasing

Configuration Options

VariableDescriptionDefault
LINGODOTDEV_API_KEYYour Lingo.dev API keyRepository variable
LINGODOTDEV_PULL_REQUESTCreate merge request instead of direct pushfalse
LINGODOTDEV_PULL_REQUEST_TITLECustom merge request titlefeat: update translations via @lingodotdev
LINGODOTDEV_COMMIT_MESSAGECustom commit messagefeat: update translations via @lingodotdev
LINGODOTDEV_WORKING_DIRECTORYCustom working directory.
LINGODOTDEV_PROCESS_OWN_COMMITSProcess this action's commitsfalse
GL_TOKENGitLab access tokenRepository variable

Example with Custom Options

yaml
lingodotdev:
  image: lingodotdev/ci-action:latest
  variables:
    GL_TOKEN: $MY_GL_TOKEN
    LINGODOTDEV_API_KEY: $MY_LINGODOTDEV_API_KEY
    LINGODOTDEV_PULL_REQUEST: "true"
    LINGODOTDEV_PULL_REQUEST_TITLE: "feat: update translations"
    LINGODOTDEV_COMMIT_MESSAGE: "feat: update translations"
    LINGODOTDEV_WORKING_DIRECTORY: "apps/web"
    LINGODOTDEV_PROCESS_OWN_COMMITS: "true"
  script:
    - echo "Done"
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH = /^feat/

Troubleshooting Common Errors

ErrorSolution
remote: HTTP Basic: Access deniedAdd the GL_TOKEN variable in your CI/CD settings
GitbeakerRequestError: ForbiddenYour GitLab token is missing the api scope