diff --git a/.changeset/clean-stale-api-docs.md b/.changeset/clean-stale-api-docs.md new file mode 100644 index 0000000000..a845151cc8 --- /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 f24249f884..f287e097a8 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: |