Skip to content

Commit bc8ed5f

Browse files
GvieveGenevieve Nuebel
andauthored
Update changelog to insert newline, target test branch (#90)
Co-authored-by: Genevieve Nuebel <genevieve.nuebel@mx.com>
1 parent 4e093ed commit bc8ed5f

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

.github/changelog_manager.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def build_entry(api_version, version_number, date)
109109

110110
<<~ENTRY
111111
## [#{version_number}] - #{date_str} (#{api_version} API)
112-
112+
113113
### Changed
114114
- #{message}
115115
ENTRY
@@ -148,7 +148,9 @@ def insert_entries(changelog, entries)
148148
rest = lines[first_entry_index..]
149149

150150
# Combine: header + new entries + rest
151-
(header + entries.map { |e| e.rstrip } + [''] + rest).join("\n")
151+
# Each entry is separated by a blank line for readability
152+
entry_lines = entries.flat_map { |e| e.rstrip.split("\n") + [''] }
153+
(header + entry_lines + rest).join("\n")
152154
end
153155
end
154156
end

.github/spec/changelog_manager_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,28 @@ def read_changelog
141141
changed_count = updated_content.scan(/### Changed/).length
142142
expect(changed_count).to be >= 2 # At least 2 from the new entries
143143
end
144+
145+
it 'separates multiple entries with blank lines' do
146+
setup_changelog
147+
setup_version_directory('v20250224', v20250224_package_fixture)
148+
setup_version_directory('v20111101', v20111101_package_fixture)
149+
150+
result = ChangelogManager.update('v20250224,v20111101')
151+
152+
expect(result).to be true
153+
updated_content = read_changelog
154+
155+
# The v20250224 entry block should be followed by a blank line before the v20111101 entry
156+
# Match: end of v20250224 entry's Changed bullet, blank line, then v20111101 header
157+
expect(updated_content).to match(
158+
/Updated v20250224 API specification.*?\n\n## \[\d+\.\d+\.\d+\] - \d{4}-\d{2}-\d{2} \(v20111101 API\)/m
159+
)
160+
161+
# The v20111101 entry block should be followed by a blank line before existing entries
162+
expect(updated_content).to match(
163+
/Updated v20111101 API specification.*?\n\n## \[2\.0\.0\]/m
164+
)
165+
end
144166
end
145167

146168
describe '.update with date range behavior' do

.github/workflows/test-auto-generate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
fail-fast: false
6969
steps:
7070
- uses: actions/checkout@v3
71+
with:
72+
ref: test-auto-generate
7173
- uses: actions/setup-node@v3
7274
with:
7375
node-version: "20"

0 commit comments

Comments
 (0)