feat: Crowdin integration scripts/actions (#40657)

This commit is contained in:
Randell Dawson
2021-01-12 11:20:54 -07:00
committed by GitHub
parent ab222e31e7
commit 0095583028
16 changed files with 670 additions and 69 deletions

View File

@@ -0,0 +1,54 @@
name: Crowdin i18n Download Translations
on:
workflow_dispatch:
push:
branches:
- test-crowdin-download
jobs:
i18n-download-curriculum-translations:
name: Learn
runs-on: ubuntu-18.04
steps:
- name: Checkout Source Files
uses: actions/checkout@v2
##### Chinese Download #####
- name: Crowdin Download for Chinese Translations
uses: crowdin/github-action@master
# options: https://github.com/crowdin/github-action/blob/master/action.yml
with:
# uploads
upload_sources: false
upload_translations: false
auto_approve_imported: false
import_eq_suggestions: false
# downloads
download_language: zh-CN
download_translations: true
skip_untranslated_files: true
export_only_approved: true
commit_message: 'chore(i8n,learn): processed chinese translations'
# pull-request
localization_branch_name: i18n-sync-learn-processed-chinese-translations
create_pull_request: false
pull_request_title: 'chore(i18n,learn): Processed chinese translations from crowdin'
pull_request_body: ''
pull_request_labels: 'scope: i18n, scope: learn, crowdin-sync, language: Chinese'
# global options
config: './curriculum/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_CURRICULUM }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}

View File

@@ -0,0 +1,64 @@
name: Crowdin i18n Upload Action
on:
workflow_dispatch:
push:
branches:
- test-crowdin-upload
jobs:
i18n-upload-curriculum-files:
name: Learn
runs-on: ubuntu-18.04
steps:
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Install Dependencies
working-directory: ./tools
run: |
cd ./crowdin
npm ci
- name: Crowdin Upload
uses: crowdin/github-action@master
# options: https://github.com/crowdin/github-action/blob/master/action.yml
with:
# uploads
upload_sources: true
upload_translations: true
auto_approve_imported: false
import_eq_suggestions: false
# downloads
download_translations: false
# pull-request
create_pull_request: false
# global options
config: './curriculum/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_CURRICULUM }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
- name: Remove Deleted English Curriculum Files From Crowdin
uses: ./tools/crowdin/actions/remove-deleted-files
env:
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}
- name: Hide Non-Translated Strings
uses: ./tools/crowdin/actions/hide-non-translated-strings
env:
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}

View File

@@ -1,47 +0,0 @@
name: Crowdin Sync
on:
workflow_dispatch:
# schedule:
# (TODO?) run this Action every 14 days
# - cron: '0 * */14 * *'
jobs:
i18n-sync-docs:
name: Docs
runs-on: ubuntu-18.04
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: false
auto_approve_imported: false
import_eq_suggestions: false
# downloads
download_translations: true
commit_message: 'chore(i8n,docs): processed translations from crowdin'
# pull-request
localization_branch_name: i18n-sync-docs
create_pull_request: true
pull_request_title: 'chore(i18n,docs): 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 }}