From 909256783650b9d577e42ee4162c09b818580844 Mon Sep 17 00:00:00 2001
From: Paul Schmiedmayer <PSchmiedmayer@users.noreply.github.com>
Date: Wed, 8 Jan 2025 22:44:02 -0800
Subject: [PATCH] Update

---
 .github/workflows/release.yml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e04abb7d..121da4a6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -46,13 +46,22 @@ jobs:
         release = response.json()
         changelog = release.get('body', '')
 
+        # Extract only the "What's Changed" section
+        match = re.search(r"## What's Changed(.*?)(##|$)", changelog, flags=re.DOTALL)
+        if match:
+            changelog = match.group(1).strip()
+        else:
+            changelog = "Bug fixes and performance improvements."
+
         # Remove all Markdown formatting
-        changelog = re.sub(r'^#+\s*', '', changelog, flags=re.MULTILINE)  # Remove all headers
+        changelog = re.sub(r'^#+\s*', '', changelog, flags=re.MULTILINE)  # Remove headers
         changelog = re.sub(r'\*\*|__|\*|_', '', changelog)  # Remove bold, italics, etc.
         changelog = re.sub(r'\[(.*?)\]\((.*?)\)', r'\1', changelog)  # Remove links but keep text
-        changelog = re.sub(r'^Full Changelog:.*$', '', changelog, flags=re.MULTILINE)  # Remove specific line
         changelog = re.sub(r'https://github\.com/[^/]+/[^/]+/pull/(\d+)', r'#\1', changelog)  # Shorten pull request URLs
 
+        # Remove excess blank lines
+        changelog = re.sub(r'\n\s*\n', '\n', changelog).strip()
+
         # Write cleaned changelog to GITHUB_OUTPUT
         with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
             output_file.write(f"changelog<<EOF\n{changelog}\nEOF\n")