foo-software / lighthouse-check-action

GitHub Action for running @GoogleChromeLabs Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications, and more!
https://github.com/marketplace/actions/lighthouse-check
MIT License
479 stars 24 forks source link

Avoid multiple comments #18

Closed schoenwaldnils closed 4 years ago

schoenwaldnils commented 4 years ago

Hi there,

is it possible to update the Github comment instead of multiple comments? Or maybe skip it when the result is the same? 🤔

adamhenson commented 4 years ago

Good question @schoenwaldnils. I've been thinking about this one myself. I'm wondering how other apps / actions handle this. If anyone would like to describe how other apps handle this behavior, that would be great. I'll try to do some research around this topic too when I have time.

adamhenson commented 4 years ago

Codecov would be a good example to follow.

schoenwaldnils commented 4 years ago

I wrote a script once to push a comment with the link to the deployed PR preview. There I checked the comment list if my bot already wrote a comment.

https://github.com/schoenwaldnils/blog/blob/master/_infrastructure/commentOnPr.js

Example: https://github.com/schoenwaldnils/blog/pull/690#issuecomment-547639678

Maybe it could be possible to have an identifier and to check if there already is a comment. And if the result is changed, to update the badges and append the link to the new result 🤔 Not a small task 😬

adamhenson commented 4 years ago

Thanks, yes I don't think this should be too difficult. I think the logic should simply be:

  1. Check for existing comment.
  2. If a comment exists, delete and post new. The idea being that most people only care about the newest scores on a single PR.

Perhaps an option to keep old comments.

adamhenson commented 4 years ago

Addressed in v1.0.10 😎

schoenwaldnils commented 4 years ago

It is working that there is only one comment. But I noticed that there is no indication if there is a change in the comment after new tests/commits. I'd either add the commit she to the comment or delete the first comment and add a new one. But the latter might still spam your email or notifications 🤔

adamhenson commented 4 years ago

Hey @schoenwaldnils - you can see a history of updates to a comment as seen here... screenshot below. It even shows the diff when you click any of the edits.

Screen Shot 2020-04-20 at 2 06 23 PM
schoenwaldnils commented 4 years ago

Ah, I didn't know. Thanks @adamhenson