From 4dc6617b45bc6684675eec23d2bcf0a28420d51a Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Mon, 4 May 2026 14:39:50 -0400 Subject: [PATCH] fix(scripts): catch style/perf/refactor commits in changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changelog script missed commits with style, perf, and refactor prefixes—they fell into "Other" without scope parsing. Group them under a new "Improvements" section. Also fix unbound variable crash when arrays are empty under set -u. Signed-off-by: Brandon McAnsh --- scripts/changelog.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 0c891926e..1a6ef0f2a 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -40,7 +40,7 @@ parse_cc() { CC_DESC="$rest" } -declare -a FEATS FIXES REFACTORS CHORES BUILDS OTHERS +FEATS=() FIXES=() IMPROVEMENTS=() CHORES=() BUILDS=() OTHERS=() while IFS= read -r line; do hash="${line%% *}" @@ -48,12 +48,14 @@ while IFS= read -r line; do msg="${line#* }" case "$msg" in - feat*:*) parse_cc "$msg"; bucket=FEATS;; - fix*:*) parse_cc "$msg"; bucket=FIXES;; - refactor*:*) parse_cc "$msg"; bucket=REFACTORS;; - chore*:*) parse_cc "$msg"; bucket=CHORES;; - build*:*) parse_cc "$msg"; bucket=BUILDS;; - *) CC_SCOPE=""; CC_DESC="$msg"; bucket=OTHERS;; + feat*:*) parse_cc "$msg"; bucket=FEATS;; + fix*:*) parse_cc "$msg"; bucket=FIXES;; + refactor*:*) parse_cc "$msg"; bucket=IMPROVEMENTS;; + style*:*) parse_cc "$msg"; bucket=IMPROVEMENTS;; + perf*:*) parse_cc "$msg"; bucket=IMPROVEMENTS;; + chore*:*) parse_cc "$msg"; bucket=CHORES;; + build*:*) parse_cc "$msg"; bucket=BUILDS;; + *) CC_SCOPE=""; CC_DESC="$msg"; bucket=OTHERS;; esac if [ -n "$CC_SCOPE" ]; then @@ -63,12 +65,12 @@ while IFS= read -r line; do fi case "$bucket" in - FEATS) FEATS+=("$entry");; - FIXES) FIXES+=("$entry");; - REFACTORS) REFACTORS+=("$entry");; - CHORES) CHORES+=("$entry");; - BUILDS) BUILDS+=("$entry");; - OTHERS) OTHERS+=("$entry");; + FEATS) FEATS+=("$entry");; + FIXES) FIXES+=("$entry");; + IMPROVEMENTS) IMPROVEMENTS+=("$entry");; + CHORES) CHORES+=("$entry");; + BUILDS) BUILDS+=("$entry");; + OTHERS) OTHERS+=("$entry");; esac done <<< "$COMMITS" @@ -80,7 +82,7 @@ echo "" section() { local title="$1"; shift local -n items="$1" - if [ ${#items[@]} -gt 0 ]; then + if [ "${#items[@]}" -gt 0 ]; then echo "### $title" echo "" printf '%s\n' "${items[@]}" @@ -90,7 +92,7 @@ section() { section "Features" FEATS section "Bug Fixes" FIXES -section "Refactors" REFACTORS +section "Improvements" IMPROVEMENTS section "Chores" CHORES section "Build" BUILDS section "Other" OTHERS