[jsweep] Clean add_workflow_run_comment.cjs#26161
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[jsweep] Clean add_workflow_run_comment.cjs#26161github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
- Extract buildCommentBody() helper to separate body assembly from API call logic - Extract postDiscussionComment() helper to unify discussion/discussion_comment GraphQL calls - Merge duplicate issues/issue_comment and pull_request/pull_request_review_comment switch cases - Remove redundant core.error in catch block (keep only core.warning for non-critical errors) - Add 11 new tests: buildCommentBody(), postDiscussionComment(), missing PR number for pull_request_review_comment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Great work from the The PR looks well-aligned with the project's agentic development workflow and is ready for maintainer review.
|
This was referenced Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cleaned
add_workflow_run_comment.cjs— a github-script context file that creates activation comments with workflow run links on issues, PRs, and discussions.Changes
add_workflow_run_comment.cjsExtracted
buildCommentBody()helperExtracted
postDiscussionComment()helperreplyToNodeIdparameterMerged duplicate switch cases
issuesandissue_commentcases share identical logic → merged with fall-throughpull_requestandpull_request_review_commentcases share identical logic → merged with fall-throughRemoved redundant
core.errorin catch blockcore.errorfollowed immediately bycore.warningfor the same errorcore.error(which creates a red error annotation) and kept onlycore.warningadd_workflow_run_comment.test.cjsAdded 11 new test cases (21 → 32 tests):
buildCommentBody()— 7 tests covering run URL inclusion, reaction marker, workflow-id marker, tracker-id marker, lock notice (issues vs pull_request), unknown event typespostDiscussionComment()— 3 tests covering top-level comment, threaded reply withreplyToId, and output settingpull_request_review_comment— 1 test (gap in original coverage)Context
github,core,context)actions/setup/js/add_workflow_run_comment.cjsValidation ✅
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npm run test:js— 32 passed ✓ (all 21 original tests + 11 new tests)Warning
The following domain was blocked by the firewall during workflow execution:
invalid.example.invalidTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.