(version: str)
| 30 | return sha[:10] |
| 31 | |
| 32 | def release_notes(version: str): |
| 33 | with open('CHANGELOG.md', 'r') as f: |
| 34 | lines = f.readlines() |
| 35 | |
| 36 | # Find the header that starts with "# {version}" |
| 37 | start_idx = None |
| 38 | for i, line in enumerate(lines): |
| 39 | if line.startswith(f'# {version}'): |
| 40 | start_idx = i |
| 41 | break |
| 42 | |
| 43 | if start_idx is None: |
| 44 | raise Exception(f"Version {version} not found in CHANGELOG.md") |
| 45 | |
| 46 | # Extract lines after the header until the next header (line starting with #) or end of file |
| 47 | content_lines = [] |
| 48 | for i in range(start_idx + 1, len(lines)): |
| 49 | line = lines[i] |
| 50 | if line.startswith('#'): |
| 51 | break |
| 52 | content_lines.append(line) |
| 53 | |
| 54 | # Write to RELEASE_NOTES.md |
| 55 | content = ''.join(content_lines).strip() + '\n' |
| 56 | with open('RELEASE_NOTES.md', 'w') as f: |
| 57 | f.write(content) |
| 58 | |
| 59 | print(f"Wrote release notes for {version} to RELEASE_NOTES.md", flush=True) |
| 60 | |
| 61 | def makedirs(path): |
| 62 | os.makedirs(path, exist_ok=True) |
nothing calls this directly
no outgoing calls
no test coverage detected