chore: Automatically output translation files on weblate PR (#2137)

Runs `lit-localize build` when a Weblate PR is approved.
This commit is contained in:
sua yoo 2024-11-11 13:53:01 -08:00 committed by GitHub
parent 5062ec11c9
commit 60fb874912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

51
.github/workflows/weblate-build.yaml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Weblate Translation Build
on:
pull_request:
paths:
- 'frontend/xliff/*.xlf'
jobs:
setup-and-build:
# Continue only on requests from Weblate user
if: github.event.pull_request.user.name == 'weblate'
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
# Setup:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Restore cache
uses: actions/cache@v4
with:
path: frontend/dist
key: ${{ runner.os }}-btrix-frontend-build-${{ hashFiles('frontend/dist') }}
restore-keys: |
${{ runner.os }}-btrix-frontend-build-
- name: Install dependencies
working-directory: frontend
env:
HUSKY: 0
run: yarn install --frozen-lockfile
- name: Build translation output
working-directory: frontend
run: yarn localize:build
- name: Commit translation output
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply `localize:build` changes
file_pattern: 'frontend/src/__generated__/**'
skip_fetch: true
skip_checkout: true