From cd4493d8cea6349070282cd53dd92453930240da Mon Sep 17 00:00:00 2001 From: Cas Donoghue Date: Thu, 2 Oct 2025 08:10:41 -0700 Subject: [PATCH] Ensure docs gen inserts at correct place in file (#18250) The regex for finding the latest release (as a fallback when current is not in the file) had a bug. This caused the generated docs to be inserted at the wrong place in the file (the end of the file) instead of the top. This commit fixes the logic such that we find the last release when the current is not found. (cherry picked from commit a3228e2dd5a910a8e6a263cf2b175f2d32f72e5b) --- tools/release/generate_release_notes_md.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/release/generate_release_notes_md.rb b/tools/release/generate_release_notes_md.rb index 36baeb3f3ae..cedf0e6ec63 100755 --- a/tools/release/generate_release_notes_md.rb +++ b/tools/release/generate_release_notes_md.rb @@ -42,7 +42,7 @@ coming_tag_index = release_notes.find_index {|line| line.match(/^## #{current_release} \[logstash-#{current_release}-release-notes\]$/) } coming_tag_index += 1 if coming_tag_index -release_notes_entry_index = coming_tag_index || release_notes.find_index {|line| line.match(/\[logstash-\d+-release-notes\]$/) } +release_notes_entry_index = coming_tag_index || release_notes.find_index {|line| line.match(/^## .*\[logstash-.*-release-notes\]$/) } unless coming_tag_index report << "## #{current_release} [logstash-#{current_release}-release-notes]\n\n"