refactor: consolidate shared JS constants into constants.cjs#21835
Merged
refactor: consolidate shared JS constants into constants.cjs#21835
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 19, 2026 18:13
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the JS action code by centralizing shared constants into constants.cjs, updating consumers to import from that module, and ensuring the consolidated module is deployed to the MCP server directories.
Changes:
- Added shared constants (bot name, URLs, limits, paths) to
actions/setup/js/constants.cjsand updated multiple scripts to import them. - Updated
actions/setup/setup.shto deployconstants.cjsto both MCP server file sets. - Expanded
actions/setup/js/constants.test.cjsto validate all expected exports.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/setup.sh | Adds constants.cjs to deployed MCP script bundles. |
| actions/setup/js/constants.cjs | Centralizes shared constants (limits, URLs, paths, bot name). |
| actions/setup/js/constants.test.cjs | Expands tests to cover all exported constants. |
| actions/setup/js/add_copilot_reviewer.cjs | Imports COPILOT_REVIEWER_BOT from constants.cjs. |
| actions/setup/js/add_reviewer.cjs | Imports COPILOT_REVIEWER_BOT from constants.cjs. |
| actions/setup/js/create_pull_request.cjs | Imports reviewer bot + FAQ URL from constants.cjs. |
| actions/setup/js/handle_create_pr_error.cjs | Imports FAQ URL from constants.cjs. |
| actions/setup/js/add_labels.cjs | Imports MAX_LABELS from constants.cjs. |
| actions/setup/js/create_discussion.cjs | Imports MAX_LABELS from constants.cjs. |
| actions/setup/js/create_issue.cjs | Imports MAX_LABELS/MAX_ASSIGNEES from constants.cjs. |
| actions/setup/js/update_issue.cjs | Imports MAX_LABELS/MAX_ASSIGNEES from constants.cjs. |
| actions/setup/js/gateway_difc_filtered.cjs | Imports gateway log path constants from constants.cjs. |
| actions/setup/js/safe_output_manifest.cjs | Imports manifest file path constant from constants.cjs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Consolidates all duplicated/shared constant declarations from non-test
.cjsfiles into the singleconstants.cjsmodule. Updates all consumers to import from there, deploys the file to all MCP server directories, and adds comprehensive tests.What changed
Constants moved to
constants.cjs:COPILOT_REVIEWER_BOTadd_copilot_reviewer.cjs,add_reviewer.cjs,create_pull_request.cjsFAQ_CREATE_PR_PERMISSIONS_URLcreate_pull_request.cjs,handle_create_pr_error.cjsMAX_LABELSadd_labels.cjs,create_discussion.cjs,create_issue.cjs,update_issue.cjsMAX_ASSIGNEEScreate_issue.cjs,update_issue.cjsGATEWAY_JSONL_PATH/RPC_MESSAGES_PATHgateway_difc_filtered.cjs(path constants, now derived fromTMP_GH_AW_PATH)MANIFEST_FILE_PATHsafe_output_manifest.cjs(path constant, now derived fromTMP_GH_AW_PATH)setup.shupdated:constants.cjsadded to bothMCP_SCRIPTS_FILESandSAFE_OUTPUTS_FILESarrays so it is deployed to all MCP server directories.Tests:
constants.test.cjsexpanded to cover all 9 exported constants with 10 test assertions across groupeddescribeblocks.Testing
make fmt-cjsandmake lint-cjspass clean