- 新增 GitHub Actions 工作流实现 PR 时自动审计国际化内容 - 添加 pre-commit 钩子,提交前自动检查相关文件并拦截问题提交 - 编写完整的 i18n 审计脚本、文档与示例报告 - 实现多维度国际化校验:键匹配、占位符、data()误用、硬编码标题等
34 lines
784 B
YAML
34 lines
784 B
YAML
# GitHub Actions 示例:i18n audit on PR
|
|
name: i18n-audit
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'lang/**'
|
|
- 'lang-bundle.json'
|
|
- '**/*.vue'
|
|
- '**/*.js'
|
|
- 'scripts/i18n_audit.py'
|
|
- 'scripts/audit_lang_bundle_v2.py'
|
|
|
|
jobs:
|
|
audit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
- name: Run i18n audit
|
|
run: |
|
|
python scripts/i18n_audit.py --strict
|
|
- name: Upload audit report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: i18n-audit-report
|
|
path: scripts/lang_audit_report_v2.json
|