@@ -58,6 +58,8 @@ def eprint(*args, **kwargs):
58
58
'mixed' : [],
59
59
}
60
60
61
+ pr_titles = dict ()
62
+
61
63
62
64
def get_username ():
63
65
usernames = {'mackendy' : 'ecstaticmorse' , 'joshua' : 'jyn514' }
@@ -95,7 +97,7 @@ def relative_change(expected, actual):
95
97
def log_change (expected , actual ):
96
98
'''Returns `ln(actual / expected)`
97
99
98
- This is prefereable to percentage change because it scales equally for
100
+ This is preferable to percentage change because it scales equally for
99
101
positive or negative changes. This means that the order of the arguments
100
102
only affects the sign of the output
101
103
@@ -172,6 +174,17 @@ def gh_link(pr):
172
174
return f'https://github.com/rust-lang/rust/issues/{ pr } '
173
175
174
176
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
+
175
188
def compare_link (start , end , stat ):
176
189
return f'https://perf.rust-lang.org/compare.html?start={ start } &end={ end } &stat={ stat .value } '
177
190
@@ -180,8 +193,9 @@ def write_section(res, *changes):
180
193
pr = res ['b' ]['pr' ]
181
194
start = res ['a' ]['commit' ]
182
195
end = res ['b' ]['commit' ]
196
+ title = gh_pr_title (pr )
183
197
184
- msg = f'[#{ pr } ]({ gh_link (pr )} )'
198
+ msg = f'{ title } [#{ pr } ]({ gh_link (pr )} )'
185
199
186
200
for change in changes :
187
201
msg += '\n - '
0 commit comments