From f5ca67cc259ebf1f2e1579d99d33762a35ca177f Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:30:03 +0100 Subject: [PATCH] [ACS-9042] Introduce Crowdin related workflows and Crowdin config (#4281) * [ACS-9042] Introduce Crowdin related workflows and Crowdin config * [ACS-9042] Proper checkout action version --- .eslintrc.json | 7 +++++++ .github/workflows/pull-from-crowdin.yml | 23 +++++++++++++++++++++++ .github/workflows/release.yml | 20 ++++++++++++++++++++ crowdin.yml | 13 +++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .github/workflows/pull-from-crowdin.yml create mode 100644 crowdin.yml diff --git a/.eslintrc.json b/.eslintrc.json index 77ed280ad..eef6375a9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -361,6 +361,13 @@ "playwright/valid-expect-in-promise": "off", "playwright/valid-title": "off" } + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "comma-dangle": ["error", "never"] + } } ] } diff --git a/.github/workflows/pull-from-crowdin.yml b/.github/workflows/pull-from-crowdin.yml new file mode 100644 index 000000000..84d1043f6 --- /dev/null +++ b/.github/workflows/pull-from-crowdin.yml @@ -0,0 +1,23 @@ +name: Pull Translations from Crowdin +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: +jobs: + pull-from-crowdin: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Pull translations from Crowdin + uses: crowdin/github-action@2d540f18b0a416b1fbf2ee5be35841bd380fc1da # v2.3.0 + with: + upload_sources: false + download_translations: true + create_pull_request: true + localization_branch_name: automated-translations-update + pull_request_title: "GH Auto: Automated Update of Translations from Crowdin" + pull_request_base_branch_name: develop + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + CROWDIN_TOKEN: ${{ secrets.CROWDIN_TRANSLATIONS_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fdb78580..090f9bd1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -131,3 +131,23 @@ jobs: npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }} npm_tag: ${{ env.TAG_NPM }} dry-run: ${{ inputs.dry-run-release }} + + push-translation-keys-to-crowdin: + name: Push translations keys to Crowdin + if: ${{ github.ref == 'refs/heads/develop' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: read + actions: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Push Source Files to Crowdin + uses: crowdin/github-action@2d540f18b0a416b1fbf2ee5be35841bd380fc1da # v2.3.0 + with: + upload_sources: true + upload_sources_args: --delete-obsolete + env: + CROWDIN_TOKEN: ${{ secrets.CROWDIN_TRANSLATIONS_TOKEN }} diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 000000000..b61783f5b --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,13 @@ +"project_id": "13" +"api_token_env": "CROWDIN_TOKEN" +"base_path": "." +"base_url": "https://hyland.api.crowdin.com" +"preserve_hierarchy": true +"files": [ + { + "source": "/**/**/i18n/en.json", + "translation": "/%original_path%/%two_letters_code%.%file_extension%", + "export_only_approved": "true", + "update_option": "update_as_unapproved" + } +]