Skip to content

Commit c712918

Browse files
committed
Update perf-result-post.js to post results to a gist
1 parent 645853a commit c712918

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

scripts/perf-result-post.js

+21-17
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,36 @@ gh.authenticate({
1717
type: "token",
1818
token: process.argv[2]
1919
});
20-
gh.issues.createComment({
21-
number: +source,
22-
owner: "Microsoft",
23-
repo: "TypeScript",
24-
body: `@${requester}
25-
The results of the perf run you requested are in! Here they are:
2620

27-
${outputTableText}`
28-
}).then(async data => {
29-
console.log(`Results posted!`);
30-
const newCommentUrl = data.data.html_url;
31-
const comment = await gh.issues.getComment({
21+
async function main() {
22+
const existingComment = await gh.issues.getComment({
3223
owner: "Microsoft",
3324
repo: "TypeScript",
3425
comment_id: +postedComment
3526
});
36-
const newBody = `${comment.data.body}
3727

38-
Update: [The results are in!](${newCommentUrl})`;
39-
return await gh.issues.updateComment({
28+
const gist = await gh.gists.create({
29+
files: { "index.md": { content: outputTableText } },
30+
description: `Perf results for ${existingComment.data.html_url}`,
31+
public: true
32+
});
33+
34+
await gh.issues.createComment({
35+
number: +source,
36+
owner: "Microsoft",
37+
repo: "TypeScript",
38+
body: `@${requester}\The results of the perf run you requested are in! They can be found at: ${gist.data.html_url}`
39+
});
40+
41+
await gh.issues.updateComment({
4042
owner: "Microsoft",
4143
repo: "TypeScript",
4244
comment_id: +postedComment,
43-
body: newBody
45+
body: `${existingComment.data.body}\n\nUpdate: [The results are in!](${gist.data.html_url})`
4446
});
45-
}).catch(e => {
47+
}
48+
49+
main().catch(e => {
4650
console.error(e);
4751
process.exit(1);
48-
});
52+
});

0 commit comments

Comments
 (0)