Skip to Content
WorkflowsPull translations

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

.github/workflows/tx-pull.yml
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

  1. Fails early if only one of APP_ID and APP_PRIVATE_KEY is set, or if neither App credentials nor BOT_GH_TOKEN is supplied.
  2. Runs the Transifex CLI with transifex_args (by default pull --force --all), using the repository’s .tx/config.
  3. Commits any changes to branch and opens or updates a pull request, authenticated as the GitHub App (or with BOT_GH_TOKEN).
  4. When the pull request was created or updated, approves it with the workflow’s github.token and 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

NameTypeDefaultDescription
transifex_argsstringpull --force --allArguments to pass to the Transifex CLI
branchstringchore/update-transifexBranch name for the PR
commit_messagestring(chore) Update translations from TransifexCommit message for the PR
pr_titlestring(chore) Update translations from TransifexTitle for the PR
pr_bodystringAutomated updates of translations pulled from TransifexBody text for the PR
author_namestringOpenMRS BotGit author name
author_emailstringinfrastructure@openmrs.orgGit author email
committer_namestringOpenMRS BotGit committer name
committer_emailstringinfrastructure@openmrs.orgGit committer email

Secrets

NameDescription
TRANSIFEX_TOKEN required
APP_IDGitHub 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_KEYPrivate key for the translation bot GitHub App.
BOT_GH_TOKENLegacy bot PAT for creating/merging the PR. Fallback when App credentials are not provided.
Last updated on