Skip to content

[Bot] Crowdin translations update #41

[Bot] Crowdin translations update

[Bot] Crowdin translations update #41

name: "[Bot] Crowdin translations update"
on:
workflow_dispatch:
inputs:
remove_unused_translations:
description: "Confirm removal of unused translations. Check them first in misc tests pipeline."
required: true
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
crowdin-sync:
if: github.repository == 'trezor/trezor-suite'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Set current timestamp as env variable
run: echo "NOW=$(date +'%s')" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install
- name: Run crowdin sync
run: |
git config --global user.name "trezor-ci"
git config --global user.email "${{ secrets.TREZOR_BOT_EMAIL }}"
git checkout -B ${{ env.BRANCH_NAME }}
yarn workspace @trezor/suite translations:download --token=${{ secrets.CROWDIN_PERSONAL_TOKEN }}
yarn workspace @trezor/suite translations:backport-en
if [ "${{ github.event.inputs.remove_unused_translations }}" = "true" ]; then
yarn workspace @trezor/suite translations:list-unused --cleanup
fi
yarn workspace @trezor/suite translations:format
yarn workspace @trezor/suite translations:extract
cat packages/suite-data/files/translations/master.json
yarn workspace @trezor/suite translations:upload --token=${{ secrets.CROWDIN_PERSONAL_TOKEN }}
git add . && git commit -m "chore: crowdin translation update" && git push origin ${{ env.BRANCH_NAME }} -f
gh config set prompt disabled
gh pr create --repo trezor/trezor-suite --title "Crowdin translations update" --body "Automatically generated PR for updating crowdin translations." --base develop --label translations
env:
GITHUB_TOKEN: ${{ secrets.TREZOR_BOT_TOKEN }}
BRANCH_NAME: trezor-ci/crowdin-sync-${{ env.NOW }}