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.
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
- Reads
generic-translation.config.json(or the path you set) from the base branch. - Lists the files that match the config’s
srcglobs and reads them through the Git Trees and Blobs APIs. - Extracts messages with the CLI’s own extractor, so hashes are identical to
generic-translation translate. Results are cached per file content. - Translates what is missing through the normal job machinery (the same cache, validation and billing as any batch job).
- Builds the
outputlocale maps (the same bytes the CLI writes: sorted keys, two-space JSON, trailing newline, only hashes found in the repository), plus anyfilesoutputs from the config. - Commits them to the branch
<branchPrefix><baseBranch>(by defaultgeneric-translation/main) and opens a pull request, or updates the open one. - If
autoMergeis 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. Ifpublishis on (or the config sayspublish: 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
- 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.
- 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
pushevent 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.jsonas 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
filesoutputs your config describes.
Something wrong or unclear on this page? Open an issue.