CI/CD
Run Babelize translations automatically in your CI pipeline — GitHub Actions, GitLab CI, and more.
Babelize is designed to run headlessly in CI. Use BABELIZE_TOKEN for authentication, --json for machine-readable output, and --no-poll/--no-pr to control how a run completes.
Authentication
Create an API key in the dashboard (Settings → API Keys) and expose it as a secret:
export BABELIZE_TOKEN=bblz_sk_xxxxxxxxThe CLI also accepts --token <token>. Prefer the environment variable so the token never appears in shell history or process listings.
Non-interactive mode
The CLI never blocks on prompts when running headlessly. Set CI=true (most CI systems do this automatically) or pass --yes/--non-interactive:
CI=true babelize run start -p <project-id> -l es,frIn non-interactive mode, missing required flags exit with USAGE (2) and an actionable message instead of prompting.
Never rely on a prompt being "cancelled" — a cancelled prompt exits with
CANCEL(128), which fails the pipeline step. Always pass the flags you need.
GitHub Actions
name: Translate
on:
push:
branches: [main]
paths:
- 'src/**'
jobs:
translate:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Install Babelize CLI
run: npm install -g @babelize/cli
- name: Run translation
env:
BABELIZE_TOKEN: ${{ secrets.BABELIZE_TOKEN }}
run: |
PROJECT_ID=$(babelize projects list --json | jq -r '.[] | select(.name=="My App") | .id')
BABEL_ID=$(babelize run start -p "$PROJECT_ID" -l es,fr --no-poll --json | jq -r '.babel_id')
babelize run status "$BABEL_ID" --watch --jsonThe run status --watch --json step blocks until the run completes and emits the final status as JSON, so a failing translation run fails the pipeline.
Generate the PR
Set --no-pr to control PR creation separately, then create it explicitly:
- name: Raise PR
env:
BABELIZE_TOKEN: ${{ secrets.BABELIZE_TOKEN }}
run: babelize pr raise "$PROJECT_ID"Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Internal error |
| 2 | Usage error (missing/invalid flags) |
| 3 | Authentication error |
| 4 | Configuration error |
| 5 | Network error |
| 6 | API error |
| 128 | Cancelled (interactive prompt cancelled / non-interactive prompt) |
Deterministic output
Babelize translation runs are incremental: only changed strings are re-translated, and cached translations are reused. The SDK build plugins write a deterministic babelize-lock.json that pins translations for reproducible builds. See the SDK docs for lockfile details.
Gotchas
- Always pass
--no-pollwhen you don't want to block, and poll separately withrun status --watch --json. - Pass
--no-prif you don't want an automatic PR from a CI run (or you'll handle PRs yourself). - On ephemeral runners, use
BABELIZE_TOKENrather thanbabelize auth login(the stored session won't survive the runner).
Last updated: 2026-08-25