Bitbucket Pipelines

Max Prilutskiy·Updated 2 months ago·1 min read

The Lingo.dev Bitbucket integration uses an official Pipe to run the localization pipeline. It commits translations directly or creates pull requests, with automatic conflict resolution through rebasing.

Prerequisites

Complete the CI/CD Setup first. You need a working i18n.json and LINGODOTDEV_API_KEY stored as a repository variable.

Authentication

Add your API key as a repository variable: Repository settings > Repository variables.

For pull request mode, also create a Bitbucket access token:

  1. Repository settings > Access tokens > Create Repository Access Token
  2. Grant scopes: Read & write repositories, Read & write pull requests
  3. Add as repository variable named BB_TOKEN

Workflow examples

Direct commit (default)

image:
  name: atlassian/default-image:2

pipelines:
  branches:
    main:
      - step:
          name: Translate
          script:
            - pipe: lingodotdev/lingo.dev:main

Pull request mode

image:
  name: atlassian/default-image:2

pipelines:
  branches:
    main:
      - step:
          name: Translate
          script:
            - pipe: lingodotdev/lingo.dev:main
              variables:
                LINGODOTDEV_PULL_REQUEST: "true"

Feature branch with full configuration

image:
  name: atlassian/default-image:2

pipelines:
  branches:
    feat/*:
      - step:
          name: Translate
          script:
            - pipe: lingodotdev/lingo.dev:main
              variables:
                LINGODOTDEV_API_KEY: "${MY_LINGODOTDEV_API_KEY}"
                BB_TOKEN: "${MY_ACCESS_TOKEN}"
                LINGODOTDEV_PULL_REQUEST: "true"
                LINGODOTDEV_PULL_REQUEST_TITLE: "feat: update translations"
                LINGODOTDEV_COMMIT_MESSAGE: "feat: update translations"
                LINGODOTDEV_WORKING_DIRECTORY: "apps/web"

Configuration variables

Variable Default Description
LINGODOTDEV_API_KEY Required Lingo.dev API key
BB_TOKEN Required for PR mode Bitbucket access token
LINGODOTDEV_PULL_REQUEST false Create pull request instead of direct commit
LINGODOTDEV_PULL_REQUEST_TITLE feat: update translations via @lingodotdev Custom PR title
LINGODOTDEV_COMMIT_MESSAGE feat: update translations via @lingodotdev Custom commit message
LINGODOTDEV_WORKING_DIRECTORY . Working directory for monorepos
LINGODOTDEV_PROCESS_OWN_COMMITS false Process commits made by this integration

Next Steps

GitHub Actions
Set up GitHub Actions integration
GitLab CI/CD
Set up GitLab CI/CD integration
Advanced Patterns
Translation checks, merge conflicts, workflow selection
Connect Your Engine
Route CI/CD translations through your engine