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

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

Open dmzeus opened this issue 1 year ago • 3 comments

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 avatar May 27 '24 09:05 dmzeus

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'.

dmzeus avatar May 27 '24 09:05 dmzeus

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

peter-evans avatar May 28 '24 10:05 peter-evans

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'.

dmzeus avatar May 29 '24 09:05 dmzeus