Skip to content

chore(i18n): Updated translations from Crowdin #3079

chore(i18n): Updated translations from Crowdin

chore(i18n): Updated translations from Crowdin #3079

Workflow file for this run

name: Crowdin Action
on:
push:
branches-ignore:
- renovate/*
- l10n_*
pull_request:
types:
- closed
branches-ignore:
- main
- l10n_*
- renovate/*
workflow_dispatch:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: 0 8 * * *
jobs:
synchronize-with-crowdin:
name: Crowdin Actions
runs-on: ubuntu-latest
env:
HUSKY: 0
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6
with:
gpg_private_key: ${{ secrets.BOT_GPG_KEY }}
git_user_signingkey: true
git_config_global: true
git_commit_gpgsign: true
git_committer_name: 'InReach [bot]'
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
name: Install pnpm
id: pnpm-install
with:
run_install: |
args: [--global, "@crowdin/cli"]
- name: Install Node.js
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_')
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version-file: .nvmrc
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Remove Jira ticket ID from branch name
id: branchregex
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4
with:
value: ${{ github.ref_name }}
regex: (IN|PLI)-\d+
flags: gi
replacement: $1-xxx
- name: Sanitize github branch name
id: sanitizebranch
uses: ashley-taylor/regex-property-action@eeec905bf940ec1c65ff777402c57f786368d9bc # v1.4
with:
value: ${{ github.head_ref || github.ref_name}}
regex: '[\\/:*?"<>|>]'
flags: gi
replacement: '_'
- name: Push sources to Crowdin
if: github.event_name != 'pull_request' && !startsWith(github.ref_name, 'l10n_')
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Synchronize sources to Crowdin
if: steps.sanitizebranch.outputs.value == 'main'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin push sources -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Pull updated translations from Crowdin
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin pull -b ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Check for updated files
if: (github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled'
uses: tj-actions/verify-changed-files@d774a4c7ebe335445d79c7b44138f56a76058ba0 # v19
id: verify-changed-files
with:
files: '**/locales/*/*.json'
- name: Format json files
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed
working-directory: apps/app
id: run-prettier
run: |
echo 'Installing package dependencies'
pnpm install
echo 'Running prettier'
pnpm format
- name: Get files to commit
if: steps.run-prettier.conclusion == 'success'
uses: tj-actions/verify-changed-files@d774a4c7ebe335445d79c7b44138f56a76058ba0 # v19
id: get-pending-files
with:
separator: <br>
- name: Commit files
id: commit-files
if: ((github.event_name != 'pull_request' && github.ref_name == 'dev') || github.event_name == 'scheduled') && steps.verify-changed-files.outputs.files_changed
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # v6
with:
token: ${{ secrets.GH_ACT_PAT }}
commit-message: Updated translations from Crowdin
committer: 'InReach [bot] <[email protected]>'
author: 'InReach [bot] <[email protected]>'
branch: ${{ format('l10n_{0}',steps.branchregex.outputs.value) }}
base: ${{ github.ref_name }}
title: 'chore(i18n): Updated translations from Crowdin'
labels: |
translations
kodiak: merge.method = 'squash'
automerge
delete-branch: true
add-paths: |
./**/locales/*/*.json
- name: Generate job summary
id: generate-job-summary
if: steps.commit-files.conclusion == 'success'
run: |
echo "# Job Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Pull request ${{steps.commit-files.outputs.pull-request-number}} has been ${{steps.commit-files.outputs.pull-request-operation}}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Changed files:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.get-pending-files.outputs.changed_files }}" >> $GITHUB_STEP_SUMMARY
- name: Delete Crowdin Branch
if: github.event_name == 'pull_request' && github.ref_name != 'l10n_dev' && steps.sanitizebranch.outputs.value != 'dev' && steps.sanitizebranch.outputs.value != 'main'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin branch delete ${{ steps.sanitizebranch.outputs.value }} --no-progress
- name: Generate OTA Release
if: github.event_name == 'schedule'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
run: crowdin distribution release ${{ secrets.CROWDIN_OTA_HASH }} --no-progress --verbose