From 1ae525f88c9002cdce17ad407a86ada8c9aeb7dd Mon Sep 17 00:00:00 2001 From: akudev Date: Wed, 23 Sep 2026 11:06:15 +0200 Subject: [PATCH] fix: remove outdated version docs during nightly API docs generation The nightly workflow generates docs for LTS + newest maintained versions, but never removed directories for versions that dropped off that list. This caused stale versions (e.g. 1.149, 1.150, 1.151) to accumulate on the gh-pages branch and appear on the website with outdated patch levels. Add a cleanup step that removes version directories no longer in the detected set. The step only runs during auto-detect (scheduled) runs, not manual dispatch, and is skipped entirely if version detection returns empty (to avoid accidentally wiping everything). --- .changeset/clean-stale-api-docs.md | 2 ++ .github/workflows/generate-api-docs.yml | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .changeset/clean-stale-api-docs.md diff --git a/.changeset/clean-stale-api-docs.md b/.changeset/clean-stale-api-docs.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/clean-stale-api-docs.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml index f24249f884c..f287e097a8d 100644 --- a/.github/workflows/generate-api-docs.yml +++ b/.github/workflows/generate-api-docs.yml @@ -156,6 +156,31 @@ jobs: echo "All versions up to date — nothing to generate" fi + - name: Remove outdated version docs + if: ${{ !inputs.versions }} + working-directory: gh-pages + run: | + VERSIONS="${{ steps.versions.outputs.versions }}" + if [ -z "$VERSIONS" ]; then + echo "No versions detected — skipping cleanup" + exit 0 + fi + + for FW in openui5 sapui5; do + FW_DIR="api/${FW}" + [ -d "$FW_DIR" ] || continue + for DIR in "$FW_DIR"/*/; do + [ -d "$DIR" ] || continue + MINOR=$(basename "$DIR") + # Check if this minor is in the detected versions for this framework + PKG=$( [[ "$FW" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" ) + if ! echo "$VERSIONS" | grep -qF "${PKG}@${MINOR}."; then + echo "🗑 Removing outdated ${FW}/${MINOR}" + rm -rf "$DIR" + fi + done + done + - name: Update index pages working-directory: gh-pages run: |