GitHub Repository Configuration
Traduttore supports both private and public Git repositories hosted on GitHub.com.
Repository Access
Traduttore connects to GitHub via either HTTPS or SSH to fetch a project’s repository. If you’re projects are not public, you need to make sure that the server has access to them by providing an SSH key. Ideally, you’d create a so-called machine user for this purpose.
You can learn more about this at Connecting to GitHub with SSH
Webhooks
To enable automatic string extraction from your GitHub projects, you need to create a new webhook for each of them.
- In your repository, go to Settings -> Webhooks. You might need to enter your password.
- Click on “Add webhook”.
- Set
https://<url-to-your-glotpress-site>.com/wp-json/traduttore/v1/incoming-webhookas the payload URL. - Choose
application/jsonas the content type. - Enter and remember a secret key.
- In the “Which events would you like to trigger this webhook?” section, select only the
pushevent.
Now, every time you push changes to GitHub, Traduttore will get notified and then attempts to update the project’s translatable strings automatically.
Note: The TRADUTTORE_GITHUB_SYNC_SECRET constant needs to be defined in your wp-config.php file to enable webhooks. Use the secret from step 5 for this.
Check out the Configuration section for a list of possible constants.
GitHub App
As an alternative to configuring webhooks for each repository individually, you can create a GitHub App. This way the app automatically has access to all repositories (or the ones you select during installation), removing the need to set up webhooks per repository.
Creating the App
- Go to
https://github.com/organizations/<name>/settings/apps/new(orhttps://github.com/settings/apps/newfor a personal account). - Enter a name and description for the app.
- In the Webhook section, check the “Active” checkbox.
- Set
https://<url-to-your-glotpress-site>.com/wp-json/traduttore/v1/incoming-webhookas the webhook URL. - Enter a webhook secret. Use the same value as the
TRADUTTORE_GITHUB_SYNC_SECRETconstant in yourwp-config.php. - In the Repository permissions section, set “Contents” to “Read-only”.
- In the Subscribe to events section, check the “Push” checkbox.
- Under “Where can this GitHub App be installed?”, choose “Only on this account” for a private app or “Any account” if you want others to install it.
Installing the App
Once the app is created, install it on your account or organization. During installation you can grant access to all repositories or select specific ones. After installation, Traduttore will automatically receive push events for the configured repositories without any additional webhook setup.