Skip to content

Commit 7cbdfdd

Browse files
committed
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).
1 parent 6a1f277 commit 7cbdfdd

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎.changeset/clean-stale-api-docs.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎.github/workflows/generate-api-docs.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,31 @@ jobs:
156156
echo "All versions up to date — nothing to generate"
157157
fi
158158
159+
- name: Remove outdated version docs
160+
if: ${{ !inputs.versions }}
161+
working-directory: gh-pages
162+
run: |
163+
VERSIONS="${{ steps.versions.outputs.versions }}"
164+
if [ -z "$VERSIONS" ]; then
165+
echo "No versions detected — skipping cleanup"
166+
exit 0
167+
fi
168+
169+
for FW in openui5 sapui5; do
170+
FW_DIR="api/${FW}"
171+
[ -d "$FW_DIR" ] || continue
172+
for DIR in "$FW_DIR"/*/; do
173+
[ -d "$DIR" ] || continue
174+
MINOR=$(basename "$DIR")
175+
# Check if this minor is in the detected versions for this framework
176+
PKG=$( [[ "$FW" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" )
177+
if ! echo "$VERSIONS" | grep -qF "${PKG}@${MINOR}."; then
178+
echo "🗑 Removing outdated ${FW}/${MINOR}"
179+
rm -rf "$DIR"
180+
fi
181+
done
182+
done
183+
159184
- name: Update index pages
160185
working-directory: gh-pages
161186
run: |

0 commit comments

Comments
 (0)