Skip to content

Commit c60483a

Browse files
committed
fix(ci): generate-release-notes should account for features, fixes, etc. in merge commits and bullet-style format:\ Summary The issue was that the generate-release-notes.sh script was only looking at commit subject lines using git log --format="%h %s", but merge commits often contain the actual feature and fix information in their commit body with
bullet point formatting like: * feat: some feature * fix: some fix Changes made: 1. Added new function get_commits_with_body() that uses git log --format="%B" to get full commit messages 2. Updated pattern matching to handle both direct commits and bullet-pointed entries in merge commits (supporting both * and - bullets) 3. Modified the feature and fix extraction to check both commit subjects and commit bodies 4. Fixed pattern anchoring by removing ^ anchors when calling the body parsing function
1 parent 3f74294 commit c60483a

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

helper-scripts/common/generate-release-notes.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ get_commits_from_repo() {
121121
fi
122122
}
123123

124+
# Function to get commits including merge commit bodies
125+
get_commits_with_body() {
126+
local repo_path="$1"
127+
local pattern="$2"
128+
129+
if [ -d "$repo_path" ]; then
130+
# Get full commit messages and extract lines matching the pattern
131+
# Handle both direct commit format and bullet point format in merge commits (*, -)
132+
git -C "$repo_path" log --format="%B" "${FROM_VERSION}..${TO_VERSION}" 2>/dev/null | \
133+
grep -E "(^${pattern}|^\* ${pattern}|^- ${pattern})" | \
134+
sed 's/^[[:space:]]*[\*-] //' | \
135+
sed 's/^[[:space:]]*//' || true
136+
fi
137+
}
138+
124139
# Function to analyze API-related commits
125140
analyze_api_changes() {
126141
local repo_path="$1"
@@ -222,14 +237,18 @@ for repo in "${ALL_REPOS[@]}"; do
222237
repo_name=$(basename "$repo")
223238
echo -e " Analyzing $repo_name..."
224239

225-
# Features
226-
repo_features=$(get_commits_from_repo "$repo" "^[a-f0-9]+ feat:" | sed "s/^[a-f0-9]* feat: /- [$repo_name] /")
240+
# Features - check both commit subjects and merge commit bodies
241+
repo_features_subject=$(get_commits_from_repo "$repo" "^[a-f0-9]+ feat:" | sed "s/^[a-f0-9]* feat: /- [$repo_name] /")
242+
repo_features_body=$(get_commits_with_body "$repo" "feat:" | sed "s/^feat: /- [$repo_name] /")
243+
repo_features=$(printf "%s\n%s" "$repo_features_subject" "$repo_features_body" | grep -v "^$" || true)
227244
if [ -n "$repo_features" ]; then
228245
FEATURES="$FEATURES$repo_features"$'\n'
229246
fi
230247

231-
# Fixes
232-
repo_fixes=$(get_commits_from_repo "$repo" "^[a-f0-9]+ fix:" | sed "s/^[a-f0-9]* fix: /- [$repo_name] /")
248+
# Fixes - check both commit subjects and merge commit bodies
249+
repo_fixes_subject=$(get_commits_from_repo "$repo" "^[a-f0-9]+ fix:" | sed "s/^[a-f0-9]* fix: /- [$repo_name] /")
250+
repo_fixes_body=$(get_commits_with_body "$repo" "fix:" | sed "s/^fix: /- [$repo_name] /")
251+
repo_fixes=$(printf "%s\n%s" "$repo_fixes_subject" "$repo_fixes_body" | grep -v "^$" || true)
233252
if [ -n "$repo_fixes" ]; then
234253
FIXES="$FIXES$repo_fixes"$'\n'
235254
fi
@@ -240,8 +259,10 @@ for repo in "${ALL_REPOS[@]}"; do
240259
BREAKING="$BREAKING$repo_breaking"$'\n'
241260
fi
242261

243-
# Performance improvements
244-
repo_perf=$(get_commits_from_repo "$repo" "^[a-f0-9]+ perf:" | sed "s/^[a-f0-9]* perf: /- [$repo_name] /")
262+
# Performance improvements - check both commit subjects and merge commit bodies
263+
repo_perf_subject=$(get_commits_from_repo "$repo" "^[a-f0-9]+ perf:" | sed "s/^[a-f0-9]* perf: /- [$repo_name] /")
264+
repo_perf_body=$(get_commits_with_body "$repo" "perf:" | sed "s/^perf: /- [$repo_name] /")
265+
repo_perf=$(printf "%s\n%s" "$repo_perf_subject" "$repo_perf_body" | grep -v "^$" || true)
245266
if [ -n "$repo_perf" ]; then
246267
PERF="$PERF$repo_perf"$'\n'
247268
fi

0 commit comments

Comments
 (0)