open-code-review/scripts/github-actions
KBS 0c97538465
ci: add translation-sync guardrails for READMEs and docs (#455)
* ci: add translation-sync guardrails for READMEs and docs

Add a check-translation-sync script + tests wired into CI: a blocking
check that all five README.<locale>.md files share an identical level-2
heading structure (compared by structure not translated text, and
code-fence-aware), and a non-blocking warning when a docs/en page changes
without its zh/ja counterparts. Addresses #419.

* ci: address review feedback on translation-sync guardrails

- Move the translation-sync job out of ci.yml into its own
  .github/workflows/translation-sync.yml, scoped with paths: filters
  (README*.md, pages/src/content/docs/**, the checker scripts) so it
  only runs on translation changes and never blocks the core pipeline.
- runReadmeCheck: short-circuit with exit 1 when any expected README*.md
  is missing, before the structure comparison, so a missing file can no
  longer mask a real divergence.
- extractHeadings: add a TODO(commonmark) note that closing fences are
  matched by fence char only, not by length.
- test: drop the dead en/zh fixtures and the void statements in
  testReorderedHeadingFails; keep the en2/zh2 pair that actually drives
  the assertion.

* ci: fix length-unaware code-fence parsing and pin node image

Address the automated review comments beyond the maintainer's minor note:

- extractHeadings: track the opening fence length and only close on a
  same-char run that is at least as long (per CommonMark). Previously a
  block opened with ```` and containing an inner ``` closed early, so
  lines inside the block could be misread as headings (or real headings
  dropped), producing false-positive structure-divergence errors. Adds a
  regression test covering the inner-shorter-fence case.
- translation-sync.yml: pin node:24.18.0 instead of the mutable node:24
  major tag, matching the golang:1.26.5 pin used by the other jobs.
2026-07-23 16:07:27 +08:00
..
check-translation-sync.js ci: add translation-sync guardrails for READMEs and docs (#455) 2026-07-23 16:07:27 +08:00
check-translation-sync.test.js ci: add translation-sync guardrails for READMEs and docs (#455) 2026-07-23 16:07:27 +08:00
post-review-comments.js feat(action): extract reusable composite PR-review GitHub Action (#337) 2026-07-09 19:08:19 +08:00
post-review-comments.test.js feat(action): extract reusable composite PR-review GitHub Action (#337) 2026-07-09 19:08:19 +08:00