Skip to content

feat(ci): unused translations auto cleanup #33

feat(ci): unused translations auto cleanup

feat(ci): unused translations auto cleanup #33

name: "[Bot] Crowdin translations update"
on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/bot-crowdin-sync.yml"
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
yarn workspace @trezor/suite translations:list-unused --cleanup
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 }}