peter-evans / create-or-update-comment

A GitHub action to create or update an issue or pull request comment
MIT License
684 stars 113 forks source link

Error: Missing comment 'body' or 'body-path'. #331

Open dmzeus opened 4 months ago

dmzeus commented 4 months ago

Hello!

I got this error when I wanted to add reaction to existing comment in PR:

- name: Put starting reaction to the comment
  uses: peter-evans/create-or-update-comment@v4
  with:
    comment-id: ${{ env.NODE_ID }}
    issue-number: ${{ env.PR_NUMBER }}
    reactions: eyes
dmzeus commented 4 months ago

Output from GHA:

Run peter-evans/create-or-update-comment@v4
  with:
    comment-id: ***
    issue-number: ***
    reactions: eyes
    token: ***
    repository: ***
    edit-mode: append
    append-separator: newline
    reactions-edit-mode: append
  env:
    PR_NUMBER: ***
    NODE_ID: ***
    REPO: ***
Error: Missing comment 'body' or 'body-path'.
peter-evans commented 4 months ago

Hi @dmzeus

It's probably because the commend-id value is empty or null. Check that there is a value being supplied by env.NODE_ID.

See the logic here: https://github.com/peter-evans/create-or-update-comment/blob/8da4c50e7142257262c9df90da4e74a59068c038/src/main.ts#L59-L69

dmzeus commented 4 months ago

Hi! @peter-evans

Tried again with these values:

Run peter-evans/create-or-update-comment@v4
  with:
    comment-id: IC_kw*** # comment-id placed here from ${{ github.event.comment.node_id }} instead env
    reactions: eyes
    body: [bot] Task started
    edit-mode: append
    token: ***
    repository: ***
    append-separator: newline
    reactions-edit-mode: append

And got an error: Error: Missing either 'issue-number' or 'comment-id'.