Refactor: Extract shared context helpers from update_issue and update_pull_request#6565
Conversation
- Created update_context_helpers.cjs with shared context validation functions - Extracted isIssueContext, getIssueNumber, isPRContext, getPRNumber - Updated update_issue.cjs to use shared helpers (79→61 lines, 23% reduction) - Updated update_pull_request.cjs to use shared helpers (130→96 lines, 26% reduction) - Added comprehensive test coverage for all context helper functions - All 2217 JavaScript tests passing Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Added update_context_helpers.cjs to GetJavaScriptSources map - Required for bundler to resolve the new shared context helper module - All unit tests passing including TestStagedPreviewInlined Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request... |
|
💥 WHOOSH! Smoke Claude springs into action on this pull request! [Panel 1 begins...] |
|
📰 BREAKING: Smoke Copilot Playwright is now investigating this pull request. Sources say the story is developing... |
|
🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰 |
Smoke Test ResultsStatus: ✅ PASS
cc
|
Copilot Engine Smoke Test ResultsLast 2 Merged PRs:
Test Results:
Overall Status: PASS 📰🔥📋 https://github.com/githubnext/gh-aw/actions/runs/20249232828 fer issue #6565 🗺️ |
Smoke Test Results (Claude Sonnet 4.5)Recent PRs:
Test Results:
Overall: PASS (5/6 tests successful)
|
|
PRs:
|
Smoke Test Results✅ Playwright MCP: Successfully navigated to github.com, title contains "GitHub" Status: PASS
|
Both
update_issue.cjsandupdate_pull_request.cjsduplicated context validation logic (isIssueContext,getIssueNumber,isPRContext,getPRNumber) with 52 lines of identical scaffolding.Changes
update_context_helpers.cjs: Extracted context validation functions with proper null handlingupdate_issue.cjs79→61 lines (-23%),update_pull_request.cjs130→96 lines (-26%)GetJavaScriptSources()and embedded sourcesExample
Before:
After:
Context validation logic is now centralized, with comprehensive test coverage (30 tests) for edge cases including null/undefined payloads and cross-event validation.
Original 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.
Changeset
update_context_helpers.cjsand updatedupdate_issue.cjsandupdate_pull_request.cjsto import and use the shared helpers, reducing duplication and improving maintainability. Fixes [duplicate-code] 🔍 Duplicate Code Detected: Issue vs PR update scripts #6563