diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 6b04c84..9e744d2 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -81,7 +81,14 @@ jobs: # Use custom version if provided if [ -n "${{ inputs.custom_version }}" ]; then - NEW_VERSION="${{ inputs.custom_version }}" + CUSTOM="${{ inputs.custom_version }}" + # Strip optional 'v' prefix and validate strict semver (X.Y.Z) + CUSTOM="${CUSTOM#v}" + if [[ ! "$CUSTOM" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Invalid custom version '${{ inputs.custom_version }}'. Must be semver (e.g., 1.2.3 or v1.2.3)." + exit 1 + fi + NEW_VERSION="$CUSTOM" else # Determine bump type if [ "${{ inputs.version_type }}" == "auto" ]; then @@ -158,7 +165,7 @@ jobs: fi # Other changes (refactor, perf, style, or non-conventional commits) - OTHERS=$(echo "$COMMITS" | grep -ivE "^(feat|fix|chore|ci|docs|test)(\(.+\))?:" | head -10 | sed 's/^/- /' || true) + OTHERS=$(echo "$COMMITS" | grep -ivE "^(feat|fix|chore|ci|docs|test)(\(.+\))?:" | sed 's/^/- /' || true) if [ -n "$OTHERS" ]; then ENTRY+="### Changed"$'\n'"$OTHERS"$'\n\n' fi