mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-18 23:07:07 -05:00
refactor(ci): refactor release notes prepare py
This commit is contained in:
1 parent
6d35b92ba6
commit
a48c00660e
1 file changed
-3
@@ -3,14 +3,12 @@ import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# GitHub's release body limit is measured in characters.
|
||||
BODY_LIMIT = 125000
|
||||
|
||||
|
||||
def release_body(notes):
|
||||
if len(notes) <= BODY_LIMIT:
|
||||
return notes
|
||||
# Keep the next section and the changelog link, even without contributors.
|
||||
return re.sub(
|
||||
r"^## What's Changed[^\S\r\n]*\r?\n.*?(?=^#{1,2} |^\*\*Full Changelog\*\*:|\Z)",
|
||||
"",
|
||||
@@ -26,7 +24,6 @@ def prepare_notes(source, body, full):
|
||||
raise ValueError("Generated release notes body must be a string")
|
||||
full.parent.mkdir(parents=True, exist_ok=True)
|
||||
full.write_text(notes, encoding="utf-8", newline="")
|
||||
# Do not shorten anything else: GitHub should reject an oversized remainder.
|
||||
body.write_text(release_body(notes), encoding="utf-8", newline="")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user