@@ -23,6 +23,7 @@ import {
23
23
ENTRY_SECTION_HEADERS ,
24
24
GroupedUnreleasedEntries ,
25
25
} from './types' ;
26
+ // eslint-disable-next-line import/no-cycle
26
27
import { getListOfPackageNames } from './helpers' ;
27
28
28
29
export const getUnreleasedSection = ( parsedChangelog : string [ ] ) => {
@@ -33,11 +34,28 @@ export const getUnreleasedSection = (parsedChangelog: string[]) => {
33
34
return unreleasedSection ;
34
35
} ;
35
36
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
+
36
50
export const getRootGroupedUnreleasedEntries = ( unreleasedSection : string [ ] ) => {
37
51
const groupedUnreleasedEntries : GroupedUnreleasedEntries = { } ;
38
52
39
53
let lastPackageHeaderIndex = 0 ;
40
54
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
+
41
59
for ( const [ index , item ] of unreleasedSection . entries ( ) ) {
42
60
// substring(4) removes "### " from entry headers (e.g. "### Changed" -> "Changed")
43
61
if ( ENTRY_SECTION_HEADERS . includes ( item . substring ( 4 ) ) ) {
0 commit comments