@@ -289,6 +289,71 @@ sections:
289289 expect ( result . entries [ 0 ] . notes ) . toEqual ( [ 'First note.' , 'Second note from same issue.' ] )
290290 } )
291291
292+ test ( 'keeps nested indentation when reloading generated notes' , ( ) => {
293+ const note = [
294+ 'You can now configure the feature:' ,
295+ '' ,
296+ '1. Enable the setting.' ,
297+ '' ,
298+ ' This paragraph continues the first step.' ,
299+ '' ,
300+ ' ```shell' ,
301+ ' ghe-config app.example.enabled true' ,
302+ ' ```' ,
303+ '' ,
304+ '1. Apply the configuration.' ,
305+ '' ,
306+ '* Parent item' ,
307+ ' * Child item' ,
308+ ] . join ( '\n' )
309+ const yaml = buildReleaseNotesYaml (
310+ [
311+ {
312+ heading : 'GitHub Actions' ,
313+ notes : [ note ] ,
314+ sourceUrl : 'https://github.com/github/releases/issues/100' ,
315+ } ,
316+ {
317+ heading : 'Some Other Heading' ,
318+ notes : [ note ] ,
319+ sourceUrl : 'https://github.com/github/releases/issues/101' ,
320+ } ,
321+ ] ,
322+ false ,
323+ [ 'GitHub Actions' ] ,
324+ )
325+ const result = loadExistingEntriesFromString ( yaml )
326+ expect ( result . entries . map ( ( e ) => e . notes ) ) . toEqual ( [ [ note ] , [ note ] ] )
327+ } )
328+
329+ test ( 'uses the first content line as the base indent of a note' , ( ) => {
330+ const content = `sections:
331+ changes:
332+ # https://github.com/github/releases/issues/100
333+ - |
334+ Parent paragraph.
335+
336+ * Item
337+ * Nested item
338+ `
339+ const result = loadExistingEntriesFromString ( content )
340+ expect ( result . entries [ 0 ] . notes ) . toEqual ( [ 'Parent paragraph.\n\n* Item\n * Nested item' ] )
341+ } )
342+
343+ test ( 'ends a note at a less indented comment that is not a release issue URL' , ( ) => {
344+ const content = `sections:
345+ closing_down:
346+ # https://github.com/github/releases/issues/100
347+ - |
348+ First note.
349+ # https://github.com/github/ghes/issues/200
350+ - |
351+ Second note.
352+ `
353+ const result = loadExistingEntriesFromString ( content )
354+ expect ( result . entries [ 0 ] . notes [ 0 ] ) . toBe ( 'First note.' )
355+ } )
356+
292357 test ( 'does not attribute errata or known issues to the previous source URL' , ( ) => {
293358 const result = loadExistingEntriesFromString ( handEditedFile )
294359 const closing = result . entries . filter ( ( e ) => e . heading === 'Closing down' )
0 commit comments