GitLab CI/CD Integration
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:
LINGODOTDEV_API_KEY
- Your Lingo.dev API keyGL_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:
- Runs the translation engine to detect and translate new content
- Stages all translation changes
- Either commits directly to your branch or creates a merge request
- Handles conflicts automatically through rebasing
Configuration Options
Variable | Description | Default |
---|---|---|
LINGODOTDEV_API_KEY | Your Lingo.dev API key | Repository variable |
LINGODOTDEV_PULL_REQUEST | Create merge request instead of direct push | false |
LINGODOTDEV_PULL_REQUEST_TITLE | Custom merge request title | feat: update translations via @lingodotdev |
LINGODOTDEV_COMMIT_MESSAGE | Custom commit message | feat: update translations via @lingodotdev |
LINGODOTDEV_WORKING_DIRECTORY | Custom working directory | . |
LINGODOTDEV_PROCESS_OWN_COMMITS | Process this action's commits | false |
GL_TOKEN | GitLab access token | Repository 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
Error | Solution |
---|---|
remote: HTTP Basic: Access denied | Add the GL_TOKEN variable in your CI/CD settings |
GitbeakerRequestError: Forbidden | Your GitLab token is missing the api scope |