File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ import re
2+ import webbrowser
3+ from pathlib import Path
4+ from urllib .parse import urlencode
5+
6+
7+ def main ():
8+ changelog_path = Path (__file__ ).parents [1 ] / "docs" / "changelog.md"
9+ changelog = changelog_path .read_text (encoding = "utf-8" )
10+
11+ match = re .search (
12+ r"^##\s+Version\s+(?P<version>\S+)[^\n]*\n+(?P<notes>.*?)(?=^##\s+Version|\Z)" ,
13+ changelog ,
14+ re .DOTALL | re .MULTILINE ,
15+ )
16+ if not match :
17+ msg = f"Unable to parse changelog at { changelog_path } "
18+ raise RuntimeError (msg )
19+
20+ version = match .group ("version" ).strip ()
21+ notes = match .group ("notes" ).strip ()
22+ params = urlencode (
23+ {
24+ "title" : f"Version { version } " ,
25+ "tag" : version ,
26+ "body" : re .sub (r"\{pr\}`(\d+)`" , r"#\1" , notes ),
27+ }
28+ )
29+
30+ url = f"https://github.com/jcrist/msgspec/releases/new?{ params } "
31+ webbrowser .open_new_tab (url )
32+
33+
34+ if __name__ == "__main__" :
35+ main ()
You can’t perform that action at this time.
0 commit comments