# SPDX-License-Identifier: AGPL-3.0-or-later name: i18n Weblate PR on: workflow_dispatch: inputs: branch: description: "Weblate branch to compile and open as a PR" required: false default: "weblate/translations" permissions: contents: write pull-requests: write concurrency: group: i18n-weblate-${{ github.event.inputs.branch || github.ref_name }} cancel-in-progress: false defaults: run: shell: bash env: GH_TOKEN: ${{ github.token }} WEBLATE_BRANCH: ${{ github.event.inputs.branch || github.ref_name }} jobs: compile: name: compile Weblate catalogs runs-on: ubuntu-24.04 timeout-minutes: 30 steps: - name: Checkout Weblate branch uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: ref: ${{ env.WEBLATE_BRANCH }} fetch-depth: 0 - name: Set up Rust toolchain uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b with: toolchain: "1.93.0" - name: Install pnpm uses: pnpm/action-setup@c5ba7f7862a0f64c1b1a05fbac13e0b8e86ba08c - name: Install Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: node-version: "24" cache: "pnpm" - name: Install dependencies run: >- cargo run --locked --quiet --manifest-path tools/ci/Cargo.toml -- ci --step install_dependencies - name: Compile translated catalogs run: pnpm i18n:weblate-compile - 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: Commit generated artifacts 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 generated catalog changes." exit 0 fi git config user.name "fluxer-i18n-bot" git config user.email "github-actions[bot]@users.noreply.github.com" 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 "i18n: compile Weblate catalogs" git push origin "HEAD:$WEBLATE_BRANCH" - name: Open Weblate PR run: | set -euo pipefail pr_number="$(gh pr list --base main --head "$WEBLATE_BRANCH" --state open --json number --jq '.[0].number // empty')" body="$(cat <<'BODY' Pulls reviewed translation updates from Weblate and includes generated runtime artifacts. Weblate project: https://weblate.fluxer.tools/projects/fluxer/ BODY )" if [[ -z "$pr_number" ]]; then gh pr create --base main --head "$WEBLATE_BRANCH" --title "i18n: update translations from Weblate" --body "$body" else gh pr edit "$pr_number" --title "i18n: update translations from Weblate" --body "$body" fi