@@ -151,28 +151,33 @@ def update_changelog(ctx: Context, version: str | None = None, dry_run: bool = F
151
151
updating the actual change log file. Defaults to False.
152
152
"""
153
153
version = version or f"{ datetime .now (tz = timezone .utc ):%Y.%-m.%-d} "
154
+ print (f"Getting all comments since { __version__ } " )
154
155
output = subprocess .check_output (["git" , "log" , "--pretty=format:%s" , f"v{ __version__ } ..HEAD" ])
155
156
lines = []
156
157
ignored_commits = []
157
158
for line in output .decode ("utf-8" ).strip ().split ("\n " ):
158
- re_match = re .match (r"Merge pull request \ #(\d+) from (.* )" , line )
159
+ re_match = re .match (r"(.*)\(\ #(\d+)\ )" , line )
159
160
if re_match and "materialsproject/dependabot/pip" not in line :
160
- pr_number = re_match [1 ]
161
- contributor , pr_name = re_match [2 ]. split ( "/" , 1 )
161
+ pr_number = re_match [2 ]
162
+ pr_name = re_match [1 ]
162
163
response = requests .get (
163
164
f"https://api.github.com/repos/materialsproject/pymatgen/pulls/{ pr_number } " ,
164
165
timeout = 60 ,
165
166
)
166
- lines += [f"* PR #{ pr_number } from @ { contributor } { pr_name } " ]
167
+ lines += [f"* PR #{ pr_number } { pr_name } " ]
167
168
json_resp = response .json ()
169
+ import pprint
170
+ pprint .pprint (json_resp )
171
+ lines += [f"* PR #{ pr_number } { pr_name } by @{ json_resp ['user' ]['login' ]} " ]
168
172
if body := json_resp ["body" ]:
169
173
for ll in map (str .strip , body .split ("\n " )):
170
174
if ll in ("" , "## Summary" ):
171
175
continue
172
176
if ll .startswith (("## Checklist" , "## TODO" )):
173
177
break
174
178
lines += [f" { ll } " ]
175
- ignored_commits += [line ]
179
+ else :
180
+ ignored_commits += [line ]
176
181
with open ("docs/CHANGES.md" , encoding = "utf-8" ) as file :
177
182
contents = file .read ()
178
183
delim = "##"
0 commit comments