Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 86082bc

Browse files
avkosspacesailor24
andauthoredJun 2, 2023
skip '### Breaking Changes' section from unreleasedSection array (#6138)
* skip '### Breaking Changes' section from unreleasedSection array * Update scripts/changelog/src/sync.ts --------- Co-authored-by: Wyatt Barnes <me@wyatt.email>
1 parent d60c285 commit 86082bc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎scripts/changelog/src/sync.ts

+18
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
ENTRY_SECTION_HEADERS,
2424
GroupedUnreleasedEntries,
2525
} from './types';
26+
// eslint-disable-next-line import/no-cycle
2627
import { getListOfPackageNames } from './helpers';
2728

2829
export const getUnreleasedSection = (parsedChangelog: string[]) => {
@@ -33,11 +34,28 @@ export const getUnreleasedSection = (parsedChangelog: string[]) => {
3334
return unreleasedSection;
3435
};
3536

37+
const skipSection = (section: string, unreleasedSection: string[]): string[] => {
38+
const index = unreleasedSection.indexOf(section);
39+
if (index !== -1) {
40+
const nextSectionIndex = unreleasedSection.findIndex(
41+
(el, i) => el.startsWith('###') && i > index,
42+
);
43+
if (nextSectionIndex !== -1) {
44+
unreleasedSection.splice(index, nextSectionIndex - index);
45+
}
46+
}
47+
return unreleasedSection;
48+
};
49+
3650
export const getRootGroupedUnreleasedEntries = (unreleasedSection: string[]) => {
3751
const groupedUnreleasedEntries: GroupedUnreleasedEntries = {};
3852

3953
let lastPackageHeaderIndex = 0;
4054
let lastEntryHeaderIndex = 0;
55+
// skip '### Breaking Changes' section from unreleasedSection array
56+
// eslint-disable-next-line no-param-reassign
57+
unreleasedSection = skipSection('### Breaking Changes', unreleasedSection);
58+
4159
for (const [index, item] of unreleasedSection.entries()) {
4260
// substring(4) removes "### " from entry headers (e.g. "### Changed" -> "Changed")
4361
if (ENTRY_SECTION_HEADERS.includes(item.substring(4))) {

0 commit comments

Comments
 (0)
This repository has been archived.