From faa11ffa0d2ee7a24d8dc58a923533bdfb0e9af1 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Fri, 24 Oct 2025 16:14:20 -0500 Subject: [PATCH 1/2] fix: improve version extraction logic to prevent false positives --- .github/scripts/version-bump.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/scripts/version-bump.sh b/.github/scripts/version-bump.sh index fc3166190..1a572cf24 100755 --- a/.github/scripts/version-bump.sh +++ b/.github/scripts/version-bump.sh @@ -77,16 +77,19 @@ update_readme_version() { in_target_module = 0 } } - /version.*=.*"/ { - if (in_target_module) { - gsub(/version[[:space:]]*=[[:space:]]*"[^"]*"/, "version = \"" new_version "\"") + /^[[:space:]]*version[[:space:]]*=/ { + if (in_target_module && $1 == "version") { + match($0, /^[[:space:]]*/) + indent = substr($0, 1, RLENGTH) + print indent "version = \"" new_version "\"" in_target_module = 0 + next } } { print } ' "$readme_path" > "${readme_path}.tmp" && mv "${readme_path}.tmp" "$readme_path" return 0 - elif grep -q 'version\s*=\s*"' "$readme_path"; then + elif grep -q '^[[:space:]]*version[[:space:]]*=' "$readme_path"; then echo "⚠️ Found version references but no module source match for $namespace/$module_name" return 1 fi @@ -148,9 +151,9 @@ main() { local current_version if [ -z "$latest_tag" ]; then - if [ -f "$readme_path" ] && grep -q 'version\s*=\s*"' "$readme_path"; then + if [ -f "$readme_path" ] && grep -q '^[[:space:]]*version[[:space:]]*=' "$readme_path"; then local readme_version - readme_version=$(grep 'version\s*=\s*"' "$readme_path" | head -1 | sed 's/.*version\s*=\s*"\([^"]*\)".*/\1/') + readme_version=$(awk '/^[[:space:]]*version[[:space:]]*=/ && $1 == "version" { match($0, /"[^"]*"/); print substr($0, RSTART+1, RLENGTH-2); exit }' "$readme_path") echo "No git tag found, but README shows version: $readme_version" if ! validate_version "$readme_version"; then From c6dabc68b9543aa59e8131dfec5135b637fe77c9 Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Mon, 27 Oct 2025 08:32:02 -0500 Subject: [PATCH 2/2] fix(version-bump): remove redundant checks --- .github/scripts/version-bump.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/scripts/version-bump.sh b/.github/scripts/version-bump.sh index 1a572cf24..6af3eca2e 100755 --- a/.github/scripts/version-bump.sh +++ b/.github/scripts/version-bump.sh @@ -78,8 +78,8 @@ update_readme_version() { } } /^[[:space:]]*version[[:space:]]*=/ { - if (in_target_module && $1 == "version") { - match($0, /^[[:space:]]*/) + if (in_target_module) { + match($0, /^[[:space]]*/ indent = substr($0, 1, RLENGTH) print indent "version = \"" new_version "\"" in_target_module = 0 @@ -153,7 +153,7 @@ main() { if [ -z "$latest_tag" ]; then if [ -f "$readme_path" ] && grep -q '^[[:space:]]*version[[:space:]]*=' "$readme_path"; then local readme_version - readme_version=$(awk '/^[[:space:]]*version[[:space:]]*=/ && $1 == "version" { match($0, /"[^"]*"/); print substr($0, RSTART+1, RLENGTH-2); exit }' "$readme_path") + readme_version=$(awk '/^[[:space:]]*version[[:space:]]*=/ { match($0, /"[^"]*"/); print substr($0, RSTART+1, RLENGTH-2); exit }' "$readme_path") echo "No git tag found, but README shows version: $readme_version" if ! validate_version "$readme_version"; then