Skip to content

Commit 98023f7

Browse files
committed
fix: parse npm show output correctly for multi-version ranges
npm show with a version range (e.g. ~1.136.0) outputs lines like '@openui5/types@1.136.17 '1.136.17'' instead of just '1.136.17'. Extract the bare semver with grep to avoid malformed version strings that fail the downstream validation.
1 parent c66c4f5 commit 98023f7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ jobs:
7575
PKG=$( [[ "$OVERVIEW_URL" == *"openui5"* ]] && echo "@openui5/types" || echo "@sapui5/types" )
7676
7777
for LINE in $MAINT_LINES; do
78-
# Get the latest published patch for this minor line
79-
LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1)
78+
# Get the latest published patch for this minor line.
79+
# npm show with a range outputs "pkg@ver 'ver'" per match; extract the bare version.
80+
LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | tail -1)
8081
if [ -n "$LATEST" ]; then
8182
VERSIONS="${VERSIONS}${VERSIONS:+,}${PKG}@${LATEST}"
8283
fi

0 commit comments

Comments
 (0)