From bc62dc5ba1607edbed532f9b30b60a621940055d Mon Sep 17 00:00:00 2001 From: Shaun Struwig <41984034+Blargian@users.noreply.github.com> Date: Sat, 12 Sep 2026 05:24:50 +0200 Subject: [PATCH] Preview translations for shared Vercel config Automatically include the translations project when vercel.json or microfrontends.json changes, while retaining label-controlled translated-content previews for ordinary documentation changes. --- .github/workflows/site-preview.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site-preview.yml b/.github/workflows/site-preview.yml index f836d816b..adc76d1dd 100644 --- a/.github/workflows/site-preview.yml +++ b/.github/workflows/site-preview.yml @@ -114,7 +114,7 @@ jobs: echo "merge_sha=$merge_sha" >> "$GITHUB_OUTPUT" echo "trust=$trust" >> "$GITHUB_OUTPUT" - - name: Select translated collections from pull request labels + - name: Select translated collections for preview id: translations env: GH_TOKEN: ${{ github.token }} @@ -123,9 +123,24 @@ jobs: mapfile -t labels < <( gh api --paginate "repos/$GITHUB_REPOSITORY/issues/$PULL_REQUEST_NUMBER/labels" --jq '.[].name' ) + mapfile -t changed_files < <( + gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PULL_REQUEST_NUMBER/files" --jq '.[].filename' + ) known_locales=(ar es fr ja ko pt-BR ru zh) include_translations=false + # These files configure both Vercel applications. Always exercise + # the translations project when they change, even when the author + # did not request a translated-content preview explicitly. + for file in "${changed_files[@]}"; do + case "$file" in + vercel.json|microfrontends.json) + include_translations=true + echo "Including translations because shared deployment configuration changed: $file" + ;; + esac + done + for label in "${labels[@]}"; do normalized="${label,,}" if [[ "$normalized" == "docs-translations-all" ]]; then