# SPDX-License-Identifier: AGPL-3.0-or-later name: i18n source sync on: workflow_dispatch: permissions: {} concurrency: group: i18n-source-sync cancel-in-progress: false defaults: run: shell: bash env: SOURCE_BRANCH: automation/i18n-source-catalogs jobs: sync: name: refresh catalogs runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Create token id: create-token uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 with: client-id: ${{ vars.FLUXER_CI_APP_ID }} private-key: ${{ secrets.FLUXER_CI_APP_KEY }} owner: fluxerapp repositories: fluxer permission-contents: write permission-pull-requests: write - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with: token: ${{ steps.create-token.outputs.token }} fetch-depth: 0 persist-credentials: false - name: Set up Rust toolchain uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de with: toolchain: "1.98.1" - name: Install pnpm uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 - name: Install Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 with: node-version: "26" cache: "pnpm" - name: Install dependencies run: >- tools/ci/run.sh ci --step install_dependencies - name: Refresh source catalogs run: pnpm i18n:source-sync - name: Format generated catalogs run: pnpm biome format --write package.json packages/i18n/package.json packages/i18n/scripts/SyncStaticI18nCatalogs.ts packages/errors/src/i18n fluxer_api/pkgs/email/src/email_i18n fluxer_api/src/api/content_i18n - name: Open source catalog PR env: GH_TOKEN: ${{ steps.create-token.outputs.token }} run: | set -euo pipefail if [[ -z "$(git status --porcelain -- fluxer_app/src/features/i18n/locales packages/errors/src/i18n fluxer_api/pkgs/email/src/email_i18n fluxer_api/src/api/content_i18n)" ]]; then echo "No source catalog changes." exit 0 fi git config user.name "fluxer-ci[bot]" git config user.email "${{ vars.FLUXER_CI_APP_USER_ID }}+fluxer-ci[bot]@users.noreply.github.com" git switch -c "$SOURCE_BRANCH" git add fluxer_app/src/features/i18n/locales packages/errors/src/i18n fluxer_api/pkgs/email/src/email_i18n fluxer_api/src/api/content_i18n git commit -m "chore(i18n): refresh source catalogs" git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" git fetch origin "$SOURCE_BRANCH" || true git push --force-with-lease="refs/heads/$SOURCE_BRANCH" origin "HEAD:$SOURCE_BRANCH" pr_number="$(gh pr list --base main --head "$SOURCE_BRANCH" --state open --json number --jq '.[0].number // empty')" body="$(cat <<'BODY' Refreshes extracted i18n source catalogs and generated locale artifacts after changes on main. Weblate will scan these catalog updates after this PR is merged. BODY )" if [[ -z "$pr_number" ]]; then gh pr create --base main --head "$SOURCE_BRANCH" --title "chore(i18n): refresh source catalogs" --body "$body" else gh pr edit "$pr_number" --title "chore(i18n): refresh source catalogs" --body "$body" fi