criterion-compare-action icon indicating copy to clipboard operation
criterion-compare-action copied to clipboard

[Feature Request] Update the benchmark comment, don't create a new one

Open HalidOdat opened this issue 4 years ago • 4 comments

It can sometimes be really frustrating to navigate in a PR with a lot of comments, and adding a new benchmark comment every time you push something does not make it easier.

So I propose the following feature we get the first comment with the benchmarks and every time we push code after that it should update/edit the previous comment so we only have one comment with the benchmark and it will be on the top of the PR (the first benchmark comment).

Question: what if I want to see previous snapshots benchmarks of the code I pushed? Github allows us to see previous revisions to the comments.

Question: how can we implement this? I have no idea.

BTW: codecov github action does this (it's possible at least :smiley: )

What do you think? @Razican @jasonwilliams

HalidOdat avatar Jun 12 '20 22:06 HalidOdat

I personally don’t know how that’s done but not against the idea. It can be useful sometimes to see the progress in your commits though.

jasonwilliams avatar Jun 12 '20 22:06 jasonwilliams

I think this would be great, yes, but we need to investigate how to do it. I guess we can somehow retrieve the list of comments and get the first one with a benchmark and update it.

Razican avatar Jun 13 '20 06:06 Razican

I think this would be great, yes, but we need to investigate how to do it. I guess we can somehow retrieve the list of comments and get the first one with a benchmark and update it.

Here is the github rest API that is used in this project to create new issues comments, we create it here , looking further I saw a get an issue comment here and a update an issue comment here

I'm not experienced with github rest API so my aproach may be completely wrong :upside_down_face:

HalidOdat avatar Jun 13 '20 06:06 HalidOdat

I do this exact thing in my own GitHub action, here's the code: https://github.com/moonrepo/run-report-action/blob/master/index.ts#L27

Basically, just insert an html comment with a unique hash (<!-- hash -->), and then find the comment with the hash and update it.

milesj avatar Oct 22 '22 21:10 milesj