Skip to content

Pull translations from Crowdin #33

Pull translations from Crowdin

Pull translations from Crowdin #33

Workflow file for this run

name: Pull translations from Crowdin
on:
workflow_dispatch:
inputs:
pr_target:
description: "PR Target Branch for Updated Translations"
type: string
default: "main"
schedule:
- cron: "0 0 * * 0"
permissions:
id-token: write
contents: write
pull-requests: write
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}--${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
jobs:
pull-from-crowdin:
runs-on: [k8s-public]
container: node:18
env:
localization_branch_name: l10n_crowdin_translations
steps:
- name: Add safe git directory
uses: Chia-Network/actions/git-mark-workspace-safe@main
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ inputs.pr_target || github.ref_name }}"
- name: Vault Login
uses: Chia-Network/actions/vault/login@main
with:
vault_url: ${{ secrets.VAULT_URL }}
role_name: github-chia-docs
- name: Get secrets from vault
uses: hashicorp/vault-action@v3
with:
url: ${{ secrets.VAULT_URL }}
token: ${{ env.VAULT_TOKEN }}
secrets: |
secret/data/crowdin token | CROWDIN_PERSONAL_TOKEN;
secret/data/crowdin project-id-docs | CROWDIN_PROJECT_ID;
# Setting this up globally so that we can also commit the compiled translations after crowdin runs
- uses: Chia-Network/actions/commit-sign/gpg@main
with:
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY_RSA }}
passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}
- name: crowdin action
uses: crowdin/[email protected]
with:
upload_sources: false
upload_translations: false
download_translations: true
crowdin_branch_name: main
localization_branch_name: ${{ env.localization_branch_name }}
create_pull_request: true
pull_request_title: "New Crowdin Translations"
pull_request_body: "New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)"
pull_request_base_branch_name: "${{ inputs.pr_target || 'main' }}"
github_user_name: "Chia Automation"
github_user_email: "[email protected]"
gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY_RSA }}
gpg_passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }}
skip_ref_checkout: "true"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compile Updated translations
run: |
npm install
npm run locale
(git add . && git commit -m "Compiled Translations" && git push origin ${{ env.localization_branch_name }}) || true