Sync translations using Crowdin #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crowdin | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'to trigger the workflow manually' | |
required: false | |
workflow_call: | |
inputs: | |
branch: | |
description: 'to trigger the workflow manually' | |
required: false | |
type: string | |
secrets: | |
CROWDIN_PROJECT_ID: | |
description: 'You need a crowdin project id to be set.' | |
required: true | |
CROWDIN_PERSONAL_TOKEN: | |
description: 'You need a crowdin token to be set.' | |
required: true | |
jobs: | |
crowdin-action: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
- name: Extract new source | |
run: yarn run i18n:extract | |
- name: Crowdin push & pull translations | |
uses: crowdin/github-action@v1 | |
id: crowdin-download | |
with: | |
upload_sources: true | |
upload_translations: false | |
download_translations: true | |
source: translations/en.po | |
translation: translations/%two_letters_code%.po | |
project_id: ${{ secrets.CROWDIN_PROJECT_ID }} | |
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | |
localization_branch_name: l10n_crowdin_translations | |
create_pull_request: true | |
pull_request_title: 'New Crowdin translations' | |
pull_request_body: 'New Crowdin pull request with translations' | |
pull_request_base_branch_name: 'next' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Enable auto-merge for the PR | |
if: steps.crowdin-download.outputs.pull_request_url | |
run: gh pr --repo $GITHUB_REPOSITORY merge ${{ steps.crowdin-download.outputs.pull_request_url }} --auto --merge | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |