From 66500aa1342f68449fe7ce3965ab8edd41948c78 Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Sun, 5 May 2024 15:24:17 +0200 Subject: [PATCH] insert automatic changelog entry at the end instead of at the start of the list --- script/livecheck | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/livecheck b/script/livecheck index 6a74f34..ab0e1e4 100755 --- a/script/livecheck +++ b/script/livecheck @@ -122,8 +122,13 @@ class Livecheck def update_changelog changelog = FSPath('CHANGELOG.markdown') lines = changelog.readlines - lines.insert(4, "\n") if lines[4] =~ /^## / - lines.insert(4, changelog_entry) + i = 4 + if lines[i] =~ /^## / + lines.insert(i, "\n") + else + i = i + 1 while lines[i] =~ /^\* / + end + lines.insert(i, changelog_entry) write(changelog, lines.join('')) end