@@ -58,6 +58,8 @@ def eprint(*args, **kwargs):
5858 'mixed' : [],
5959}
6060
61+ pr_titles = dict ()
62+
6163
6264def get_username ():
6365 usernames = {'mackendy' : 'ecstaticmorse' , 'joshua' : 'jyn514' }
@@ -95,7 +97,7 @@ def relative_change(expected, actual):
9597def log_change (expected , actual ):
9698 '''Returns `ln(actual / expected)`
9799
98- This is prefereable to percentage change because it scales equally for
100+ This is preferable to percentage change because it scales equally for
99101 positive or negative changes. This means that the order of the arguments
100102 only affects the sign of the output
101103
@@ -172,6 +174,17 @@ def gh_link(pr):
172174 return f'https://github.com/rust-lang/rust/issues/{ pr } '
173175
174176
177+ def gh_pr_title (pr ):
178+ if pr in pr_titles :
179+ return pr_titles .get (pr )
180+
181+ url = f'https://api.github.com/repos/rust-lang/rust/pulls/{ pr } '
182+ with urllib .request .urlopen (url ) as f :
183+ data = json .loads (f .read ())
184+ pr_titles [pr ] = data ['title' ]
185+ return pr_titles [pr ]
186+
187+
175188def compare_link (start , end , stat ):
176189 return f'https://perf.rust-lang.org/compare.html?start={ start } &end={ end } &stat={ stat .value } '
177190
@@ -180,8 +193,9 @@ def write_section(res, *changes):
180193 pr = res ['b' ]['pr' ]
181194 start = res ['a' ]['commit' ]
182195 end = res ['b' ]['commit' ]
196+ title = gh_pr_title (pr )
183197
184- msg = f'[#{ pr } ]({ gh_link (pr )} )'
198+ msg = f'{ title } [#{ pr } ]({ gh_link (pr )} )'
185199
186200 for change in changes :
187201 msg += '\n - '
0 commit comments