chore(docs): self-clean orphans and surface failed languages in i18n … (#22278)
## Summary Two robustness fixes to `docs-i18n-pull.yaml` so localized docs can't silently drift: 1. **Prune orphan localized files.** The pull only adds/updates files, never deletes — so localized copies of renamed/moved/deleted English pages linger and serve dead URLs (recently ~113 of them). A new `prune-orphan-translations` script (run with `--apply` in the workflow, on real pulls only) removes any `l/<lang>/**` file whose English source no longer exists. 2. **Surface per-language download failures.** The loop previously swallowed failures with `|| echo "Warning..."`, so a language whose Crowdin server-side build fails (e.g. `ja`, failing at 79%) was skipped *silently* and froze indefinitely while every other language updated. We now collect failures, still commit the languages that succeeded, and **fail the run at the end** so a broken language is visible. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,14 +71,17 @@ jobs:
|
||||
# Pull docs translations from Crowdin one language at a time
|
||||
# This avoids build timeout issues when processing all languages at once
|
||||
- name: Pull translated docs from Crowdin
|
||||
id: pull
|
||||
if: github.event_name != 'pull_request' && (inputs.force_pull == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|
||||
run: |
|
||||
# Languages supported by Mintlify (see packages/twenty-docs/src/shared/supported-languages.ts)
|
||||
LANGUAGES="fr ar cs de es it ja ko pt ro ru tr zh-CN"
|
||||
|
||||
FAILED_LANGUAGES=""
|
||||
|
||||
for lang in $LANGUAGES; do
|
||||
echo "=== Pulling translations for $lang ==="
|
||||
crowdin download \
|
||||
if ! crowdin download \
|
||||
--config .github/crowdin-docs.yml \
|
||||
--token "$CROWDIN_PERSONAL_TOKEN" \
|
||||
--base-url "https://twenty.api.crowdin.com" \
|
||||
@@ -86,11 +89,15 @@ jobs:
|
||||
--skip-untranslated-strings=false \
|
||||
--skip-untranslated-files=false \
|
||||
--export-only-approved=false \
|
||||
--verbose || echo "Warning: Failed to pull $lang, continuing with other languages..."
|
||||
--verbose; then
|
||||
echo "::warning::Crowdin download failed for $lang (likely a server-side build failure); its translations will be stale until fixed."
|
||||
FAILED_LANGUAGES="$FAILED_LANGUAGES $lang"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "=== Download complete ==="
|
||||
echo "failed_languages=${FAILED_LANGUAGES# }" >> "$GITHUB_OUTPUT"
|
||||
echo "=== Download complete (failed:${FAILED_LANGUAGES:-none}) ==="
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
@@ -100,6 +107,9 @@ jobs:
|
||||
|
||||
- name: Fix translated documentation links
|
||||
run: bash packages/twenty-docs/scripts/fix-translated-links.sh
|
||||
- name: Prune orphan localized translations
|
||||
if: github.event_name != 'pull_request' && (inputs.force_pull == true || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|
||||
run: yarn docs:prune-orphans --apply
|
||||
|
||||
- name: Regenerate navigation template
|
||||
if: github.event_name == 'pull_request'
|
||||
@@ -168,3 +178,9 @@ jobs:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
run: |
|
||||
gh workflow run automerge-i18n.yaml --repo twentyhq/twenty-infra --ref main
|
||||
|
||||
- name: Fail run if any language failed to download
|
||||
if: always() && steps.pull.outputs.failed_languages != ''
|
||||
run: |
|
||||
echo "::error::Crowdin download failed for:${{ steps.pull.outputs.failed_languages }}. These languages were skipped and are now stale — fix the source (e.g. build-breaking translations) and re-run."
|
||||
exit 1
|
||||
|
||||
@@ -39,6 +39,7 @@ jobs:
|
||||
uses: crowdin/github-action@8868a33591d21088edfc398968173a3b98d51706 # v2
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_sources_args: '--delete-obsolete'
|
||||
upload_translations: false
|
||||
download_translations: false
|
||||
localization_branch_name: i18n-docs
|
||||
|
||||
@@ -83,6 +83,7 @@ jobs:
|
||||
uses: crowdin/github-action@8868a33591d21088edfc398968173a3b98d51706 # v2
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_sources_args: '--delete-obsolete'
|
||||
upload_translations: true
|
||||
download_translations: false
|
||||
localization_branch_name: i18n
|
||||
|
||||
@@ -81,6 +81,7 @@ jobs:
|
||||
uses: crowdin/github-action@8868a33591d21088edfc398968173a3b98d51706 # v2
|
||||
with:
|
||||
upload_sources: true
|
||||
upload_sources_args: '--delete-obsolete'
|
||||
upload_translations: true
|
||||
download_translations: false
|
||||
localization_branch_name: i18n-website
|
||||
|
||||
Reference in New Issue
Block a user