unsplash / comment-on-pr

A GitHub Action to comment on the relevant open PR when a commit is pushed.
MIT License
151 stars 84 forks source link

Check for existing notification before commenting #3

Closed TimmyCarbone closed 5 years ago

TimmyCarbone commented 5 years ago

Not 100% sure that we want this but ...

Every time we push to an existing PR, the action gets triggered and a new comment is added to the PR even though the exact same comment was already written in the past.

This change checks for an identical existing comment in the PR before commenting again. If an identical (same login and message body) comment is found, the action resolves correctly but without re-writing a duplicate comment.

When the comment contains a user notification (@ xxxx), this avoids spamming the user.

The reason why I'm hesitating is that there might be some cases where we actually want to repeat the notification (because the new schema change from the most recent push is actually important for example)

Proof that it works:

Screen Shot 2019-08-02 at 15 00 48
aaronklaassen commented 5 years ago

Yeah I'm good with this - I think the "accidentally spam the user" is a lot more common than "really need a second notification."

brijshah commented 5 years ago

any chance this gets merged?