Tip
For information about GitHub integration in Phrase TMS, refer to GitHub (TMS).
Phrase Strings integrates with GitHub repositories to synchronize localization files between Phrase and GitHub.
By default, repositories are connected using a GitHub OAuth App. Personal access tokens are also supported and are mainly intended for self-hosted instances or environments where OAuth App installation is not possible.
Prerequisites
-
The
.phrase.ymlconfiguration file must be present in the root of the branch to be monitored. The file defines which files to import (pull) or export (push) from the repository. -
Read and write access are required for the repository.
-
Incorrectly defined configuration files may cause errors. Ensure that the file contains at least one push and one pull target, correct file formats and the correct setting of the
update_translationsparameter. -
-
The GitHub OAuth App must be installed in the GitHub organization or account that owns the repository.
-
The repository must be included in the OAuth App installation.
-
Permissions to install or authorize GitHub Apps are required in the target organization or account.
-
-
-
Classic tokens
Requires the repo scope (
public_repoif synchronizing with a public repository) -
Fine-grained tokens
Requires the following permissions:
-
Contents: Read and write
-
Pull requests: Read and write
-
-
Ensure repository settings do not require signed commits.
-
-
If SSO is enabled in GitHub, it must also be enabled for the access token.
-
The phrase_translations branch cannot be protected.
Note
Due to continuous improvements, the user interface may not be exactly the same as presented in the video.
Once the configuration file is in place, to connect a repository, follow these steps:
-
From the page, scroll down to and click Configure.
The page opens.
-
Click Add Sync/GitHub.
The settings window opens.
-
Select a project from the dropdown list.
-
Select the authentication method:
-
If the GitHub App is not yet installed, click Authenticate. Authentication is performed once and can be reused for multiple repository syncs.
If the GitHub App is already installed, click Manage installation to complete the app installation for the target organization or account. Repository access is managed at the organization or account level and is not tied to an individual GitHub user.
-
Provide a personal with an API scope.
When using a personal access token, repository access depends on the GitHub user who created the token.
-
Provide the GitHub self-hosted and a personal with an API scope.
-
-
Select a from the dropdown list.
-
Select a from the dropdown list to import (push) and export (pull) from. This is usually the master branch.
-
Optionally, provide a branch name for the pull request. If left empty, a branch will be created with the default value .
-
Click Validate Configuration to ensure authentication settings and configuration file are correct.
-
Optionally select an option to determine when new or updated files are automatically imported in the project.
-
Click Save.
The project is now connected to the selected GitHub repository and added to the list.
-
(Optional) Click the pencil icon to rename the integration.
Ensure the push commands are correctly configured within the .phrase.yml configuration file. Push options are the same as for the uploads API endpoint.
To import files:
-
From the page, select a project and click Import
.
Language files (defined as push source entries in the configuration file) are imported into the project.
A default locale must be present.
Note
In case of issues upon importing, use the CLI client to test the
.phrase.ymlconfiguration file locally and check for any error messages.If required, contact Phrase Technical Support and attach the
.phrase.ymlconfiguration file to the support request.
Ensure the pull commands are correctly configured within the .phrase.yml configuration file. Pull options (e.g. include_empty_translations parameter) are the same as for the locales download API endpoint.
To export files:
-
From the page, select a project and click Export
.
The window is displayed.
-
Provide the target branch in the field.
The most recent files in the repository will be exported as a new pull request to the desired branch.
-
Once files are exported, the pull request can be merged or closed in the repository and the branch can be deleted.
Note
In case of issues upon exporting, use the CLI client to test the .phrase.yml configuration file locally and check for any error messages.
If required, contact Phrase Technical Support and attach the .phrase.yml configuration file to the support request.
Repo syncs keep a history of the latest imports and exports for each Phrase Strings project.
To view the history: