Sync Crowdin #104
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: Sync Crowdin | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- crowdin.yml | |
- lang/values/base/* | |
- .github/workflows/crowdin.yml | |
- scripts/crowdin.mjs | |
schedule: | |
- cron: "59 16 * * 6" # “At 16:59 on Saturday.” | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
sync-crowdin: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Crowdin | |
uses: crowdin/github-action@v2 | |
with: | |
config: crowdin.yml | |
download_translations: true | |
push_translations: true | |
commit_message: "chore(i18n): sync translations" | |
localization_branch_name: i18n | |
create_pull_request: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | |
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | |
merge: | |
needs: sync-crowdin | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Pull main | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
- name: Pull i18n | |
uses: actions/checkout@v4 | |
with: | |
ref: i18n | |
path: i18n | |
- uses: pnpm/action-setup@v3 | |
with: | |
package_json_file: main/package.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "23.0.0-nightly" | |
cache: "pnpm" | |
cache-dependency-path: main/pnpm-lock.yaml | |
- run: pnpm install --frozen-lockfile | |
working-directory: main | |
- name: Clear old files | |
run: rm *.json | |
working-directory: main/lang/values | |
- name: Write files | |
run: node ../../../main/scripts/crowdin.mjs | |
working-directory: i18n/lang/values | |
- name: Publish changes | |
working-directory: main | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add lang/values/. | |
git commit -m "chore(i18n): sync translations (${{ github.sha || github.triggering_actor }})" || true | |
git pull --ff-only | |
git push |