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

How to delete duplicate comments with latest changes (v.1.3.0)? #46

Closed Jorundur closed 3 years ago

Jorundur commented 3 years ago

In my action .yml file I've got these lines (changed link to be more generic here):

      - uses: unsplash/comment-on-pr@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          msg: Example link: [see it here](https://some.link/example-${{ github.event.number }}).

Up until now, this has only posted one comment on my PR and then always updated that comment when I pushed more changes to the PR branch. However, after the latest changes it posts a new comment each time I push a new change to the branch.

Obviously, I'm always getting the latest version of comment-on-pr via the - uses: unsplash/comment-on-pr@master when I should perhaps be referring to a specific version... i.e. doing - uses: unsplash/comment-on-pr@v1.2.0 would likely fix this for me, but I'm curious how to fix this while using the latest changes. I couldn't figure that our from reading the code.

It looks like it only deletes the previous (duplicate) comment if I have have a delete_prev_regex_msg argument? https://github.com/unsplash/comment-on-pr/blob/master/entrypoint.sh#L59

What should the regex be if I simply want to match the previous message? I feel like it's a bit odd to have to provide a regex to delete a duplicate.

Jorundur commented 3 years ago

Nevermind, I think I was misunderstanding things.

It looks like I just have to pass in the check_duplicate_msg as "true" and then the script exits before adding a new comment!

Jorundur commented 3 years ago

Nevermind that nevermind... it looks like check_duplicate_msg is true by default, so I wonder why this isn't working for me...