Fix comment creation to post to parent thread instead of replacing comments#1833
Fix comment creation to post to parent thread instead of replacing comments#1833
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
@copilot we should never edit a comment anymore. remove entirely
There was a problem hiding this comment.
Removed comment editing functionality entirely. Commit: 9a4c1b7
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot revert the last changes. The requirement is to remove code comment UPDATES and only do comment CREATE. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Reverted to only create comments (never edit). The code was already only creating comments - renamed functions/variables to clarify this. Commit: 0c8df45 |
|
@copilot the current code replaces the content of existing comments. If the event is an issue comment, you need to create a new comment on the issue itself. And so forth for all the events. Review each event and update the logic to create/add a comment to the thread it belongs to. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed endpoints to create new comments on parent threads. For issue_comment and pull_request_review_comment events, now posts to the issue/PR comments endpoint instead of the specific comment endpoint. Discussion comments were already correct. Commit: ea9c2b8 |
Problem
The
add_reaction_and_edit_comment.cjsscript had two critical issues:Solution
First commit:
shouldEditComment = truefor non-command workflowsissuesevent handlerpull_requestevent handlerdiscussionevent handlerSecond commit (reverted based on feedback):
Third commit (clarification):
addOrEditCommentWithWorkflowLink()→addCommentWithWorkflowLink()shouldEditComment→shouldCreateCommentFourth commit (critical bug fix):
issue_commentevent: Changed endpoint from/repos/.../issues/comments/{comment_id}to/repos/.../issues/{issue_number}/commentspull_request_review_commentevent: Changed endpoint from/repos/.../pulls/comments/{comment_id}to/repos/.../issues/{pr_number}/commentsaddDiscussionCommentmutation)Key Changes
Endpoint Corrections
For
issue_commentevents:POST /repos/.../issues/comments/{comment_id}- Would update the triggering comment ❌POST /repos/.../issues/{issue_number}/comments- Creates new comment on the issue thread ✅For
pull_request_review_commentevents:POST /repos/.../pulls/comments/{review_comment_id}- Would update the triggering review comment ❌POST /repos/.../issues/{pr_number}/comments- Creates new comment on the PR thread ✅For
discussion_commentevents:addDiscussionCommentmutation ✅Behavior Change
Before:
After:
GITHUB_AW_COMMANDis set) ✅Testing
All 534 JavaScript tests pass ✅
Files Changed
pkg/workflow/js/add_reaction_and_edit_comment.cjs- Renamed functions/variables, fixed comment creation endpoints, added validationpkg/workflow/js/add_reaction_and_edit_comment.test.cjs- Updated test expectations for corrected endpointsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.