@@ -23,6 +23,7 @@ import {
2323 ENTRY_SECTION_HEADERS ,
2424 GroupedUnreleasedEntries ,
2525} from './types' ;
26+ // eslint-disable-next-line import/no-cycle
2627import { getListOfPackageNames } from './helpers' ;
2728
2829export 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+
3650export 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