Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/translation-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: translation-sync

# Content-validation guardrails, kept out of ci.yml (which is build/test/lint):
# - blocking: all README*.md translations share the same ## section structure.
# - non-blocking: warn when a docs/en page changes without its zh/ja counterpart.
# Scoped with paths: so it only runs when a translation or the checker changes,
# and a slow container pull here never delays core CI feedback.

on:
push:
paths:
- "README*.md"
- "pages/src/content/docs/**"
- "scripts/github-actions/check-translation-sync.*"
pull_request:
paths:
- "README*.md"
- "pages/src/content/docs/**"
- "scripts/github-actions/check-translation-sync.*"

jobs:
translation-sync:
runs-on: self-hosted
timeout-minutes: 10
container:
# Pinned to an exact 24.x for reproducible builds, matching the
# golang:1.26.5 pin used by the other jobs (avoids the mutable node:24 tag).
image: node:24.18.0
steps:
# fetch-depth: 0 so the non-blocking docs check can diff base...head.
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Trust workspace
run: git config --global --replace-all safe.directory '*'

# Validate the guardrail script itself (plain Node, no deps).
- name: Test translation-sync guardrail
run: node scripts/github-actions/check-translation-sync.test.js

# BLOCKING: all README*.md translations must share an identical ##
# (level-2) section structure. Fails with an ::error annotation on divergence.
- name: Check README translation structure
run: node scripts/github-actions/check-translation-sync.js readmes

# NON-BLOCKING: on PRs, warn (::warning) when a file under
# pages/src/content/docs/en/** changed without its zh/ja counterpart.
# continue-on-error keeps it advisory: it never fails the build.
- name: Check docs translation sync
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
env:
OCR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
OCR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: node scripts/github-actions/check-translation-sync.js docs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"scripts": {
"postinstall": "node scripts/install.js",
"test:github-actions": "node scripts/github-actions/post-review-comments.test.js"
"test:github-actions": "node scripts/github-actions/post-review-comments.test.js && node scripts/github-actions/check-translation-sync.test.js"
},
"repository": {
"type": "git",
Expand Down
Loading
Loading