From 63efc10eca6bb52472300a1ea74003a36d843a9b Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com> Date: Wed, 30 Sep 2020 16:19:48 +0530 Subject: [PATCH] feat(i18n): crowdin actions for docs (#39730) --- .github/workflows/crowdin-i18n.yml | 53 ++++++++++++++++++++++++++++++ docs/crowdin.yml | 36 +++++++++++--------- 2 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/crowdin-i18n.yml diff --git a/.github/workflows/crowdin-i18n.yml b/.github/workflows/crowdin-i18n.yml new file mode 100644 index 00000000000..5e160661900 --- /dev/null +++ b/.github/workflows/crowdin-i18n.yml @@ -0,0 +1,53 @@ +name: Crowdin Sync +on: + workflow_dispatch: + # schedule: + # (TODO?) run this Action every 14 days + # - cron: '0 * */14 * *' + push: + branches: + - i18n-dev + # Treat the below branches as special case for working on workflows + - actions-** + +jobs: + + i18n-sync-docs: + name: Docs + runs-on: ubuntu-latest + + steps: + - name: Checkout Source Files + uses: actions/checkout@v2 + + - name: Crowdin Synchronize + uses: crowdin/github-action@master + # options: https://github.com/crowdin/github-action/blob/master/action.yml + with: + # uploads + upload_translations: true + auto_approve_imported: true + import_eq_suggestions: true + + # downloads + download_translations: true + commit_message: 'chore(docs,i8n): processed translations from crowdin' + + # pull-request + localization_branch_name: i18n-sync-docs + create_pull_request: true + pull_request_title: 'chore(docs,i8n): processed translations from crowdin' + pull_request_body: '' + pull_request_labels: 'scope: i18n, scope: docs, crowdin-sync' + + # global options + config: './docs/crowdin.yml' + base_url: ${{ secrets.CROWDIN_BASE_URL_FCC }} + + # Uncomment below to debug + dryrun_action: true + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_DOCS }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }} diff --git a/docs/crowdin.yml b/docs/crowdin.yml index 7710cadfc51..a2b7f866f94 100644 --- a/docs/crowdin.yml +++ b/docs/crowdin.yml @@ -1,16 +1,20 @@ -# -# This config is used with the Crowdin CLI or GitHub Actions -# -# CLI Usage: crowdin upload sources --identity ~/.crowdin.yaml -# -"preserve_hierarchy": true -files: [ - { - "source" : "/*.md", - "translation" : "/i18n/%language%/%original_file_name%", - }, - { - "source" : "/flight-manuals/*.md", - "translation" : "/i18n/%language%/flight-manuals/%original_file_name%", - } -] \ No newline at end of file +# Used with the Crowdin CLI or GitHub Actions + +# CLI Usage (use --dryrun for preview): +# crowdin download --config ./docs/crowdin.yml --identity ~/.crowdin.yaml +# crowdin upload sources --config ./docs/crowdin.yml --identity ~/.crowdin.yaml +# crowdin upload translations --config ./docs/crowdin.yml --identity ~/.crowdin.yaml + +# These tokens are overriden when using cli with project_id and api_token +project_id_env: CROWDIN_PROJECT_ID +api_token_env: CROWDIN_PERSONAL_TOKEN + +# https://support.crowdin.com/configuration-file-v3/#saving-directory-structure-on-server +preserve_hierarchy: true +base_path: docs + +files: + - source: /*.md + translation: /i18n/%language%/%original_file_name% + - source: /flight-manuals/*.md + translation: /i18n/%language%/flight-manuals/%original_file_name%