Notify your GitHub Actions Workflow when there are new translations and that the build is required. This guide describes setting up a Crowdin webhook to invoke the build.
GitHub Actions' documentation says we should send the following request to trigger the build:
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/dispatches \
-d '{"ref":"topic-branch","inputs":{"name":"Mona the Octocat","home":"San Francisco, CA"}}'
Also, it could be a Repository Dispatch event.
We will configure Crowdin to send this request without any middleware, just by setting up the webhook on a needed event (e.g. File is 100% translated).
Depending on a Crowdin Edition you use, please check the documentation how to create a webhook in crowdin.com and Crowdin Enterprise.
Below is an example of a fully configured Crowdin webhook:
Workflow example:
name: 'crowdin'
on:
workflow_dispatch:
repository_dispatch:
types:
- file-fully-translated
jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: crowdin action
uses: crowdin/github-action@v1
with:
upload_translations: true
download_translations: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
Also, you can access the webhook payload fields in your workflow:
${{ github.event.client_payload.file }}
For more advanced setup please refer to the official documentation.
Crowdin is a platform that helps you manage and translate content into different languages. Integrate Crowdin with your repo, CMS, or other systems. Source content is always up to date for your translators, and translated content is returned automatically.
Learn MoreReleased on Dec 7, 2022
Updated on Jul 12, 2024
Published by Andrii Bodnar
Identifier:github-actions-webhook