Skip to content

Commit 0fdd561

Browse files
AndersonBYclaude
andcommitted
fix: indent Python heredoc content in YAML
Fix YAML syntax error by properly indenting Python code within heredoc 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1d943b1 commit 0fdd561

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -53,45 +53,46 @@ jobs:
5353
# Try to extract changelog from CHANGELOG.md first
5454
if [ -f "CHANGELOG.md" ]; then
5555
# Look for the version section in CHANGELOG.md
56-
python3 - "$VERSION" << 'EOF' > release_notes.md
57-
import re
58-
import sys
59-
60-
def extract_version_changelog(version):
61-
try:
62-
with open('CHANGELOG.md', 'r', encoding='utf-8') as f:
63-
content = f.read()
64-
65-
# Look for version section (matches [X.X.X] or [Unreleased])
66-
version_pattern = rf'\[{re.escape(version)}\].*?(?=\n## |\n\[|$)'
67-
match = re.search(version_pattern, content, re.DOTALL | re.MULTILINE)
56+
VERSION=$VERSION python3 << 'EOF' > release_notes.md
57+
import re
58+
import sys
59+
import os
6860
69-
if match:
70-
# Extract the content and clean it up
71-
section = match.group(0)
72-
# Remove the version header line
73-
lines = section.split('\n')[1:]
74-
# Remove empty lines at the start
75-
while lines and not lines[0].strip():
76-
lines.pop(0)
77-
changelog_content = '\n'.join(lines).strip()
78-
79-
if changelog_content:
80-
print(changelog_content)
81-
return True
61+
def extract_version_changelog(version):
62+
try:
63+
with open('CHANGELOG.md', 'r', encoding='utf-8') as f:
64+
content = f.read()
65+
66+
# Look for version section (matches [X.X.X] or [Unreleased])
67+
version_pattern = rf'\[{re.escape(version)}\].*?(?=\n## |\n\[|$)'
68+
match = re.search(version_pattern, content, re.DOTALL | re.MULTILINE)
69+
70+
if match:
71+
# Extract the content and clean it up
72+
section = match.group(0)
73+
# Remove the version header line
74+
lines = section.split('\n')[1:]
75+
# Remove empty lines at the start
76+
while lines and not lines[0].strip():
77+
lines.pop(0)
78+
changelog_content = '\n'.join(lines).strip()
79+
80+
if changelog_content:
81+
print(changelog_content)
82+
return True
83+
84+
return False
85+
except Exception as e:
86+
print(f"Error reading CHANGELOG.md: {e}", file=sys.stderr)
87+
return False
8288
83-
return False
84-
except Exception as e:
85-
print(f"Error reading CHANGELOG.md: {e}", file=sys.stderr)
86-
return False
87-
88-
# Try to get version-specific changelog
89-
version = sys.argv[1] if len(sys.argv) > 1 else "0.0.0"
90-
if not extract_version_changelog(version):
91-
# If no specific version found, check for [Unreleased]
92-
if not extract_version_changelog("Unreleased"):
93-
print("## What's Changed\n\nSee CHANGELOG.md for detailed changes.")
94-
EOF
89+
# Try to get version-specific changelog
90+
version = os.environ.get('VERSION', '0.0.0')
91+
if not extract_version_changelog(version):
92+
# If no specific version found, check for [Unreleased]
93+
if not extract_version_changelog("Unreleased"):
94+
print("## What's Changed\n\nSee CHANGELOG.md for detailed changes.")
95+
EOF
9596
fi
9697
9798
# If CHANGELOG.md doesn't exist or doesn't have version info, generate from git

0 commit comments

Comments
 (0)