Pull translations from Crowdin #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/github-action@v2.2.0 | |
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: "automation@chia.net" | |
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 |