@@ -300,6 +300,7 @@ def generate_activity_md(
300300 tags = None ,
301301 include_issues = False ,
302302 include_opened = False ,
303+ include_release_notes = False ,
303304 strip_brackets = False ,
304305 heading_level = 1 ,
305306 branch = None ,
@@ -338,6 +339,9 @@ def generate_activity_md(
338339 Include Issues in the markdown output. Default is False.
339340 include_opened : bool
340341 Include a list of opened items in the markdown output. Default is False.
342+ include_release_notes : bool
343+ Search PR descriptions for a `# Release Notes` block. If found, include
344+ the contents of this block with the changelog output for the PR.
341345 strip_brackets : bool
342346 If True, strip any text between brackets at the beginning of the issue/PR title.
343347 E.g., [MRG], [DOC], etc.
@@ -537,9 +541,27 @@ def generate_activity_md(
537541 for irow , irowdata in items ["data" ].iterrows ():
538542 author = irowdata ["author" ]
539543 ititle = irowdata ["title" ]
544+ description = irowdata ["body" ]
540545 if strip_brackets and ititle .strip ().startswith ("[" ) and "]" in ititle :
541546 ititle = ititle .split ("]" , 1 )[- 1 ].strip ()
542547 this_md = f"- { ititle } [#{ irowdata ['number' ]} ]({ irowdata ['url' ]} ) ([@{ author } ](https://github.com/{ author } ))"
548+
549+ # Search the description for release notes and add them if they exist
550+ if include_release_notes :
551+ lines = description .split ("\n " )
552+ headers = [ii .startswith ("#" ) for ii in lines ]
553+ release_notes = [ii for ii in headers if "# release notes" in ii .lower ()]
554+ if release_notes :
555+ # Find the line of the next header to know when to stop
556+ release_notes_line = release_notes [0 ]
557+ next_header_ix = headers .index (release_notes_line ) + 1
558+ next_header = headers [next_header_ix ]
559+ release_notes_start = lines .index (release_notes_line )
560+ release_notes_stop = lines .index (next_header )
561+
562+ # Append the release notes to our output markdown
563+ release_notes = "\n " .join (lines [release_notes_start :release_notes_stop ])
564+ this_md += f"\n { release_notes } "
543565 items ["md" ].append (this_md )
544566
545567 # Get functional GitHub references: any git reference or master@{YY-mm-dd}
0 commit comments