DocsPlatform

GitHub agent

Connect a project to a GitHub repository and let Generic Translation open a pull request with updated locale files, on every push or on demand.

On this page

Not available on the hosted instance yet. The agent needs a GitHub App, and the person who runs a Generic Translation instance has to register it and store its credentials. That has not been done on the hosted instance, so there GET /v1/github/app reports configured: false and the GitHub routes answer 501 github_not_configured. The agent has been tested only against an in-memory fake of GitHub built for the tests (including one that checks the app’s signed token). It has never run against github.com. If you self-host, register the App and treat your first runs as the real test.

The CLI and GitHub Action run in your own CI. The GitHub agent is the hosted alternative: Generic Translation reads your repository through the GitHub API, translates, and opens the pull request itself, with nothing to install in your CI.

What a run does

  1. Reads generic-translation.config.json (or the path you set) from the base branch.
  2. Lists the files that match the config’s src globs and reads them through the Git Trees and Blobs APIs.
  3. Extracts messages with the CLI’s own extractor, so hashes are identical to generic-translation translate. Results are cached per file content.
  4. Translates what is missing through the normal job machinery (the same cache, validation and billing as any batch job).
  5. Builds the output locale maps (the same bytes the CLI writes: sorted keys, two-space JSON, trailing newline, only hashes found in the repository), plus any files outputs from the config.
  6. Commits them to the branch <branchPrefix><baseBranch> (by default generic-translation/main) and opens a pull request, or updates the open one.
  7. If autoMerge is on, squash-merges the pull request when GitHub allows it. If it does not, the pull request stays open and a warning is added to the run. If publish is on (or the config says publish: true), the translations are published to the CDN after a successful run.

If nothing changed, the run ends as no_changes and no pull request is created.

Run statuses: queued, running, completed, failed, no_changes. Each run records stats (sourceFiles, files, messages, locales, translations, missing, changedFiles, warnings), the branch, the pull request URL and number, and an error if it failed. A run waits in running while its translation jobs finish.

Runs are resumable. Each step holds a lease and makes at most 40 GitHub calls, and the every-minute scheduler continues the rest, so a big repository takes several passes.

A run fails with credits_insufficient if billing is on and the organization is out of allowance and credits.

Connect a project

  1. Install the App on your account or organization (admin of the Generic Translation organization). GitHub redirects back to the dashboard, which links the installation to your Generic Translation organization.
  2. Connect a repository from the project’s GitHub screen in the dashboard, or with the API.
Option Default Meaning
repo required owner/name. It must be included in the installation.
baseBranch the repository’s default branch Branch to read from and open the pull request against.
configPath generic-translation.config.json Relative path inside the repository.
trigger push push starts a run when the base branch is pushed; manual only runs on request.
branchPrefix generic-translation/ The pull request branch is this plus the base branch name.
autoMerge false Squash-merge the pull request automatically when GitHub allows it.
publish false Publish to the CDN after a successful run.

Connecting and disconnecting needs the admin role; starting a run needs member.

Triggers

  • Manual: “Run now” in the dashboard, or POST /v1/projects/:projectId/github/run. A second request while a run is still queued returns that run.
  • Push: GitHub sends a push event to the instance; its signature (X-Hub-Signature-256) is verified. A push to the connected base branch starts a run. Pushes made by Generic Translation’s own bot are ignored, so it does not trigger itself.

The webhook also keeps installations in sync (installation and installation_repositories events): deleting the installation, or removing a repository from it, drops the connections that depended on it.

Permissions and linking rules

The App asks for Contents (read and write), Pull requests (read and write) and Metadata (read-only), and subscribes to push.

To stop someone from claiming another account’s installation, Generic Translation links an installation to an organization only if it was created or changed on GitHub within the last 24 hours, and only if no other organization has linked it. For an older installation, open its Configure page on GitHub and save it, then link again.

Limits

  • The agent reads generic-translation.config.json as a plain file. It does not run your build, and it cannot see files outside the repository.
  • It extracts what the CLI would extract. Anything the CLI cannot read statically is reported as a warning (at most 25 per run) rather than failing the run.
  • It writes only the locale outputs and files outputs your config describes.

Something wrong or unclear on this page? Open an issue.

Type to search the documentation.