Pull translations
tx-pull.yml downloads the latest translations from Transifex, commits any changes to a branch, opens (or updates) a
pull request, approves it and enables auto-merge. It is usually run on a schedule; its counterpart,
Push translations, uploads the source strings.
Usage
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
pull-translations:
if: github.repository_owner == 'openmrs'
uses: openmrs/openmrs-contrib-gha-workflows/.github/workflows/tx-pull.yml@main
secrets:
TRANSIFEX_TOKEN: ${{ secrets.TRANSIFEX_TOKEN }}
APP_ID: ${{ secrets.OMRS_TRANSLATION_APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.OMRS_TRANSLATION_APP_PRIVATE_KEY }}What it does
- Fails early if only one of
APP_IDandAPP_PRIVATE_KEYis set, or if neither App credentials norBOT_GH_TOKENis supplied. - Runs the Transifex CLI with
transifex_args(by defaultpull --force --all), using the repository’s.tx/config. - Commits any changes to
branchand opens or updates a pull request, authenticated as the GitHub App (or withBOT_GH_TOKEN). - When the pull request was created or updated, approves it with the workflow’s
github.tokenand enables auto-merge (squash).
The pull request must be opened with an App token or a personal access token. A pull request created with
github.token does not trigger CI, and the same identity cannot approve its own pull request, so the workflow does
not fall back to github.token.
OpenMRS defaults
OpenMRS repositories pass the translation App’s credentials, stored as the organization secrets
OMRS_TRANSLATION_APP_ID and OMRS_TRANSLATION_APP_PRIVATE_KEY, plus the organization’s TRANSIFEX_TOKEN. The App
needs contents: write and pull-requests: write on the repository. Repositories that have not migrated can still
pass the legacy BOT_GH_TOKEN instead.
Outside OpenMRS
The Transifex workflows are for repositories in the OpenMRS organization, which share its Transifex project. They are not supported for use elsewhere.
Permissions
The job requests contents: write and pull-requests: write. The calling workflow must grant at least these.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
transifex_args | string | pull --force --all | Arguments to pass to the Transifex CLI |
branch | string | chore/update-transifex | Branch name for the PR |
commit_message | string | (chore) Update translations from Transifex | Commit message for the PR |
pr_title | string | (chore) Update translations from Transifex | Title for the PR |
pr_body | string | Automated updates of translations pulled from Transifex | Body text for the PR |
author_name | string | OpenMRS Bot | Git author name |
author_email | string | infrastructure@openmrs.org | Git author email |
committer_name | string | OpenMRS Bot | Git committer name |
committer_email | string | infrastructure@openmrs.org | Git committer email |
Secrets
| Name | Description |
|---|---|
TRANSIFEX_TOKEN required | |
APP_ID | GitHub App ID for the translation bot. When set with APP_PRIVATE_KEY, a short-lived App token is preferred over BOT_GH_TOKEN. |
APP_PRIVATE_KEY | Private key for the translation bot GitHub App. |
BOT_GH_TOKEN | Legacy bot PAT for creating/merging the PR. Fallback when App credentials are not provided. |