Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dmzeus opened this issue May 27, 2024 · 3 comments
Open

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

dmzeus opened this issue May 27, 2024 · 3 comments

Comments

@dmzeus
Copy link

dmzeus commented May 27, 2024

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
Copy link
Author

dmzeus commented May 27, 2024

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
Copy link
Owner

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:

if (inputs.commentId) {
if (!body && !inputs.reactions) {
throw new Error("Missing comment 'body', 'body-path', or 'reactions'.")
}
} else if (inputs.issueNumber) {
if (!body) {
throw new Error("Missing comment 'body' or 'body-path'.")
}
} else {
throw new Error("Missing either 'issue-number' or 'comment-id'.")
}

@dmzeus
Copy link
Author

dmzeus commented May 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants