unsplash / comment-on-pr

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

Script is not exiting when there's a duplicate comment unless either regex arg is provided #47

Closed Jorundur closed 2 years ago

Jorundur commented 2 years ago

The script should exit (and therefore not add a new comment) if there's a duplicate comment already.

This is done via the check_duplicate_msg arg which is true by default. I.e. if this is true and a duplicate is found, then the script exits.

However, we only check this inside the condition if !duplicate_msg_pattern.empty? || !delete_prev_regex_msg.empty?, i.e. either one of those arguments has to exist for the script to exit if there's a duplicate. (https://github.com/unsplash/comment-on-pr/blob/master/entrypoint.sh#L43)

Can this be changed so that it checks for duplicates regardless of the duplicate_msg_pattern and delete_prev_regex_msg arguments?

See my closed issue https://github.com/unsplash/comment-on-pr/issues/46 for more context for how I got here.

bradbindy commented 2 years ago

+1 this has broken my action, I only have check_duplicate_msg: true and no other arg except the message and it is now making duplicates

Jorundur commented 2 years ago

This bug seems to have been introduced here: https://github.com/unsplash/comment-on-pr/pull/44

Jorundur commented 2 years ago

@BradStapleton FYI:

Until this is fixed, I've temporarily added the duplicate_msg_pattern argument like so:

with:
  msg: Message text example [link](https://some.link/something-${{ github.event.number }})
  duplicate_msg_pattern: Message text example*

This prevents duplicate comments.

aaronklaassen commented 2 years ago

Fixed in #50. Available in v1.3.1.