feat(i18n): crowdin actions for docs (#39730)

pull/39733/head
Mrugesh Mohapatra 2020-09-30 16:19:48 +05:30 committed by GitHub
parent 4e51e845bb
commit 63efc10eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 16 deletions

53
.github/workflows/crowdin-i18n.yml vendored Normal file
View File

@ -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 }}

View File

@ -1,16 +1,20 @@
# # Used with the Crowdin CLI or GitHub Actions
# This config is used with the Crowdin CLI or GitHub Actions
# # CLI Usage (use --dryrun for preview):
# CLI Usage: crowdin upload sources --identity ~/.crowdin.yaml # crowdin download --config ./docs/crowdin.yml --identity ~/.crowdin.yaml
# # crowdin upload sources --config ./docs/crowdin.yml --identity ~/.crowdin.yaml
"preserve_hierarchy": true # crowdin upload translations --config ./docs/crowdin.yml --identity ~/.crowdin.yaml
files: [
{ # These tokens are overriden when using cli with project_id and api_token
"source" : "/*.md", project_id_env: CROWDIN_PROJECT_ID
"translation" : "/i18n/%language%/%original_file_name%", api_token_env: CROWDIN_PERSONAL_TOKEN
},
{ # https://support.crowdin.com/configuration-file-v3/#saving-directory-structure-on-server
"source" : "/flight-manuals/*.md", preserve_hierarchy: true
"translation" : "/i18n/%language%/flight-manuals/%original_file_name%", base_path: docs
}
] files:
- source: /*.md
translation: /i18n/%language%/%original_file_name%
- source: /flight-manuals/*.md
translation: /i18n/%language%/flight-manuals/%original_file_name%