[jsweep] Clean add_reaction_and_edit_comment.cjs#30062
Conversation
…d_edit_comment.cjs - Import addReaction and addDiscussionReaction from add_reaction.cjs instead of duplicating the identical implementations - Remove the duplicated DISCUSSION_REACTION_MAP (identical to REACTION_MAP) - Add 2 new test cases: lock notice for issue_comment events and no lock notice for discussion events (GH_AW_LOCK_FOR_AGENT=true) - Tests: 35 passed (was 33) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors add_reaction_and_edit_comment.cjs to reuse the shared reaction helpers from add_reaction.cjs, reducing duplicated implementation while preserving the module’s exported API.
Changes:
- Replaced locally duplicated reaction helper functions in
add_reaction_and_edit_comment.cjswith imports fromadd_reaction.cjs. - Removed the duplicated discussion reaction map now that the shared helper owns that mapping.
- Added lock-notice tests for
issue_commentanddiscussioncomment creation paths.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/add_reaction_and_edit_comment.cjs |
Swaps duplicated local reaction helpers for shared imports and keeps existing exports intact. |
actions/setup/js/add_reaction_and_edit_comment.test.cjs |
Adds coverage for lock-notice behavior on issue_comment and discussion events. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
🧪 Test Quality Sentinel ReportTest Quality Score: 75/100
Test Classification Details
Flagged Items — Notes
|
…le to Record Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b0267898-a1b6-4083-902c-5f3a467fd0ce Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 003f098. Added an |
* refactor(js): remove duplicated reaction helpers from add_reaction_and_edit_comment.cjs - Import addReaction and addDiscussionReaction from add_reaction.cjs instead of duplicating the identical implementations - Remove the duplicated DISCUSSION_REACTION_MAP (identical to REACTION_MAP) - Add 2 new test cases: lock notice for issue_comment events and no lock notice for discussion events (GH_AW_LOCK_FOR_AGENT=true) - Tests: 35 passed (was 33) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(js): fix TypeScript error in aw_context.cjs - object not assignable to Record Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b0267898-a1b6-4083-902c-5f3a467fd0ce Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Summary
Cleaned
actions/setup/js/add_reaction_and_edit_comment.cjsby removing code duplication.Context
github-script context (uses
github,core,contextglobals)Changes
Removed duplicated code:
addReaction()— identical implementation existed inadd_reaction.cjs; now imported from thereaddDiscussionReaction()— identical implementation existed inadd_reaction.cjs; now imported from thereDISCUSSION_REACTION_MAPconstant — identical toREACTION_MAPinadd_reaction.cjs; removed in favour of the imported functions using their own mapThe duplicated functions were byte-for-byte identical to their counterparts in
add_reaction.cjs, with no logic difference. They are now imported and re-exported so the public API of this module is unchanged.Test Improvements
Added 2 new test cases (33 → 35 tests):
should add lock notice for issue_comment event when GH_AW_LOCK_FOR_AGENT=true— the lock-notice condition covers bothissuesandissue_commentevents but only theissuescase was testedshould not add lock notice for discussion events when GH_AW_LOCK_FOR_AGENT=true— confirms lock notice is suppressed for non-issue event typesValidation ✅
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓ (pre-existing unrelated error inaw_context.cjsonly)npx vitest run add_reaction_and_edit_comment— 35/35 passed ✓