From 19a54ef2ce0968a44554277f1cdba23339d28423 Mon Sep 17 00:00:00 2001 From: Raunak Madan Date: Tue, 14 Apr 2026 21:49:10 +0530 Subject: [PATCH 1/2] Comment on pruned PR previews Signed-off-by: Raunak Madan --- .github/workflows/build-and-preview-docs.yml | 39 +++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-preview-docs.yml b/.github/workflows/build-and-preview-docs.yml index 79e85098663c7..bb2156e5ed12e 100644 --- a/.github/workflows/build-and-preview-docs.yml +++ b/.github/workflows/build-and-preview-docs.yml @@ -22,12 +22,16 @@ defaults: run: shell: bash +env: + PREVIEW_RETENTION_LIMIT: 6 + jobs: build-and-deploy-preview: runs-on: ubuntu-24.04 + outputs: + removed_prs_json: ${{ steps.prune-previews.outputs.removed_prs_json }} env: HUGO_VERSION: 0.157.0 - PREVIEW_RETENTION_LIMIT: 6 steps: - name: Checkout PR code @@ -103,10 +107,12 @@ jobs: path: gh-pages-maintenance - name: Prune old PR previews + id: prune-previews if: github.event.action != 'closed' run: | cd gh-pages-maintenance mkdir -p pr-preview + removed_prs=() mapfile -t previews < <( while IFS= read -r preview; do @@ -118,14 +124,18 @@ jobs: ) if (( ${#previews[@]} <= PREVIEW_RETENTION_LIMIT )); then + echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT" exit 0 fi for preview in "${previews[@]:PREVIEW_RETENTION_LIMIT}"; do rm -rf "pr-preview/$preview" + removed_prs+=("${preview#pr-}") done if git diff --quiet -- pr-preview; then + echo "removed_prs=" >> "$GITHUB_OUTPUT" + echo "removed_prs_json=[]" >> "$GITHUB_OUTPUT" exit 0 fi @@ -135,9 +145,12 @@ jobs: git commit -m "Prune old PR previews" git push + echo "removed_prs=$(IFS=,; echo "${removed_prs[*]}")" >> "$GITHUB_OUTPUT" + echo "removed_prs_json=$(printf '%s\n' "${removed_prs[@]}" | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT" + - name: Comment PR with Preview URL if: github.event.action != 'closed' - uses: marocchino/sticky-pull-request-comment@v2 + uses: marocchino/sticky-pull-request-comment@v3 with: header: pr-preview message: | @@ -153,3 +166,25 @@ jobs: preview-branch: gh-pages umbrella-dir: pr-preview action: remove + + comment-on-pruned-previews: + if: github.event.action != 'closed' && needs.build-and-deploy-preview.outputs.removed_prs_json != '[]' + needs: build-and-deploy-preview + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + pr_number: ${{ fromJson(needs.build-and-deploy-preview.outputs.removed_prs_json) }} + + steps: + - name: Update sticky comment for pruned preview + uses: marocchino/sticky-pull-request-comment@v3 + with: + header: pr-preview + number: ${{ matrix.pr_number }} + message: | + Preview deployment for PR #${{ matrix.pr_number }} removed. + + This PR preview was automatically pruned because we keep only the ${{ env.PREVIEW_RETENTION_LIMIT }} most recently updated previews on GitHub Pages to stay within deployment size limits. + + If needed, push a new commit to this PR to generate a fresh preview. From eb4f4e7f5bdde1d227547f43f92c7d583a916b4a Mon Sep 17 00:00:00 2001 From: Raunak Madan <143412156+CodexRaunak@users.noreply.github.com> Date: Wed, 15 Apr 2026 01:19:02 +0530 Subject: [PATCH 2/2] Update hugo.toml Signed-off-by: Raunak Madan <143412156+CodexRaunak@users.noreply.github.com> --- docs/hugo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hugo.toml b/docs/hugo.toml index 3ff3f9916f008..512366bdb55ed 100644 --- a/docs/hugo.toml +++ b/docs/hugo.toml @@ -3,7 +3,7 @@ title = "Documentation" relativeURLs = true canonifyURLs = false -# Language settings + contentDir = "content/en" defaultContentLanguage = "en" defaultContentLanguageInSubdir = false