File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,12 +83,14 @@ awk -v entry="$entry" '
8383 next
8484 }
8585
86- in_unreleased && !found_changed && /^## / {
87- print "### Changed"
88- print entry
89- print ""
90- found_changed = 1
91- inserted = 1
86+ in_unreleased && /^## / {
87+ if (!found_changed) {
88+ print "### Changed"
89+ print entry
90+ print ""
91+ found_changed = 1
92+ inserted = 1
93+ }
9294 in_unreleased = 0
9395 print
9496 next
Original file line number Diff line number Diff line change @@ -145,6 +145,14 @@ cat > "$changelog_fixture" <<'EOF'
145145- Fixed something.
146146
147147## [1.0.0]
148+
149+ ### Changed
150+ - Changed something in a released version.
151+
152+ ## [0.9.0]
153+
154+ ### Changed
155+ - Changed something in an older released version.
148156EOF
149157
150158chmod 640 " $changelog_fixture "
@@ -155,6 +163,9 @@ assert_contains "$changelog_fixture" \
155163assert_contains " $changelog_fixture " \
156164 " - Updated the bundled Zoekt version. [#42](https://github.com/sourcebot-dev/sourcebot/pull/42)" \
157165 " the changelog helper should add the generated PR link"
166+ entry_count=$( grep -Fc " sourcebot/pull/42" " $changelog_fixture " )
167+ assert_equals " $entry_count " 1 \
168+ " the changelog helper should add the PR entry only to Unreleased"
158169CHANGELOG_PATH=" $changelog_fixture " " $changelog_script " 42
159170entry_count=$( grep -Fc " sourcebot/pull/42" " $changelog_fixture " )
160171assert_equals " $entry_count " 1 \
You can’t perform that action at this time.
0 commit comments