create-or-update-comment icon indicating copy to clipboard operation
create-or-update-comment copied to clipboard

Cannot add reaction to the main comment of a review

Open lugi0 opened this issue 10 months ago • 3 comments

Hi,

I'm trying to leave a reaction on the main comment that is created when a user leaves a review from the diff view (so not the inline comments the review might contain). This is the code I'm using

- name: Acknowledge the review with thumbs up reaction
        if: ${{ github.event.review }}
        uses: peter-evans/create-or-update-comment@v4
        with:
          comment-id: ${{ github.event.review.id }}
          reactions: '+1'

I can see from the actions logs that this step is running and seeing both the review and comment

Run peter-evans/create-or-update-comment@v4
  with:
    comment-id: <my-comment-id>
    reactions: +1
    token: ***
    repository: <my-repo>
    edit-mode: append
    append-separator: newline
    reactions-edit-mode: append
Warning: Adding reaction '+1' to comment id '<my-comment-id>' failed.

And you can see it fails to add the reaction. I am assuming that review.id is the id of the comment, since review.body is the body of the comment. Is that a wrong assumption?

lugi0 avatar Mar 14 '25 11:03 lugi0

Hi @lugi0

Unfortunately, this action doesn't support review comments. They are different from issue/pr comments and require a different API.

peter-evans avatar Mar 14 '25 17:03 peter-evans

Hey @peter-evans , thanks for the reply. Are you aware if this is the correct endpoint you'd need to interact with in order to add a reaction to a review comment? https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-a-pull-request-review-comment If so, would it be feasible/desirable to add this functionality to the action?

lugi0 avatar Mar 15 '25 15:03 lugi0

It looks correct to me.

Rather than add to this action I think it would be best to have a completely separate action. e.g. "create-or-update-review-comment"

fyi, comments on commits are also a different set of APIs and I have a separate action for that which behaves very similarly to this one: https://github.com/peter-evans/commit-comment

peter-evans avatar Mar 16 '25 13:03 peter-evans