Skip to content

Update add_reaction job to always create new comments and add comment-repo output#1809

Merged
pelikhan merged 5 commits intomainfrom
copilot/update-add-reaction-job
Oct 16, 2025
Merged

Update add_reaction job to always create new comments and add comment-repo output#1809
pelikhan merged 5 commits intomainfrom
copilot/update-add-reaction-job

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 16, 2025

✅ Complete: Update add_reaction Job to Always Create New Comments

Changes Required

  • Analyze current implementation
  • Update JavaScript logic to always create new comments (never edit)
  • Ensure comment-id output is set for all scenarios (including repo info)
  • Add comment-repo output for downstream job use
  • Update tests to verify new behavior
  • Run all tests to ensure no regressions
  • Verify the changes work correctly
  • Add periods at end of workflow link text sentences
  • Add GraphQL comment creation support for discussion_comment events

Summary of Changes

JavaScript Changes (add_reaction_and_edit_comment.cjs):

  • Removed the conditional logic that checked whether to create or edit comments
  • Now always creates new comments for all event types (issues, pull_request, issue_comment, pull_request_review_comment, discussion, discussion_comment)
  • Added comment-repo output containing the repository in owner/repo format
  • Simplified the logic by removing GET and PATCH operations for editing
  • Added periods at end of workflow link text for proper punctuation
  • Implemented full GraphQL support for discussion_comment events to create new comments on discussion threads using the addDiscussionComment mutation

Go Changes (compiler.go):

  • Added comment_repo to the activation job outputs map
  • Ensures downstream jobs can access the repository information

Test Updates:

  • Added 3 new JavaScript tests verifying new comments are always created
  • Updated existing tests to verify comment-repo output
  • Updated discussion_comment test to verify GraphQL comment creation behavior
  • Updated Go tests to check for comment_repo in the generated YAML
  • All 534 JavaScript tests pass ✅
  • All Go tests pass ✅

Verification

✅ No GET or PATCH operations remain in generated lock files
comment-repo output present in all lock files
✅ All workflows recompiled with updated JavaScript
✅ Behavior verified: comments are always created (never edited)
✅ Proper punctuation added to all workflow link text
✅ Full GraphQL support for both discussion and discussion_comment events

Original prompt

Update the JavaScript that implements the add_reaction job to NOT edit existing comments and instead always create a new comment. The comment id and comment repo should be an output of the add_reaction job so that it can be reused by other jobs.Agentic Plan for add_reaction Job Update

Objective:
Modify the add_reaction job in JavaScript to ensure it no longer edits existing comments, and instead always creates a new comment. Additionally, the job should output the new comment ID and associated repository for downstream use by other jobs.

Plan Steps:

Review Current Implementation
Inspect the current add_reaction job logic to identify where it searches for and edits existing comments.
Locate the code handling the output of comment identifiers.
Update Comment Creation Logic
Remove or disable the conditional logic that checks for existing comments.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Modified add_reaction_and_edit_comment.cjs to always create new comments instead of editing existing ones
- Added comment-repo output to all comment creation scenarios
- Updated compiler.go to include comment_repo in activation job outputs
- Added comprehensive tests for the new behavior
- All tests pass (JavaScript and Go)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update add_reaction job to always create new comments Update add_reaction job to always create new comments and add comment-repo output Oct 16, 2025
Copilot AI requested a review from pelikhan October 16, 2025 15:24
eventTypeDescription = "event";
}

const workflowLinkText = `Agentic [${workflowName}](${runUrl}) triggered by this ${eventTypeDescription}`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add a dot at the end of the sentence.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added periods at the end of the workflow link text sentences in commit 0c7e9a3.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 16, 2025 16:02
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot add support for discussion and discussion-comment event (use graphql)

- Now creates new comments on discussion threads for discussion_comment events
- Uses GraphQL API to add discussion comments (same as discussion events)
- Updated test to verify new comment creation behavior
- All 534 JavaScript tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot add support for discussion and discussion-comment event (use graphql)

Added GraphQL comment creation support for discussion_comment events in commit 9ea5fa9. Discussion events already had full GraphQL support. Both now create new comments on discussion threads using the addDiscussionComment mutation.

Copilot AI requested a review from pelikhan October 16, 2025 17:45
@pelikhan pelikhan marked this pull request as ready for review October 16, 2025 19:24
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit 81be982 into main Oct 16, 2025
3 checks passed
@pelikhan pelikhan deleted the copilot/update-add-reaction-job branch October 16, 2025 19:27
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

Successfully merging this pull request may close these issues.

2 participants