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 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:
- Select your avatar > Edit profile > Access tokens
- Click Add new token, name it (e.g., "Lingo.dev")
- Enable scopes:
api,read_repository,write_repository - 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:
- mainMerge 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:
- mainCommit 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:
- mainMerge 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:
- mainCustomization#
Override defaults using CLI flags:
bash
npx lingo.dev@latest ci --api-key "$LINGODOTDEV_API_KEY" --commit-message "chore: update translations"