[code-simplifier] Simplify close safe-output handlers#15504
Merged
Conversation
- Move requires to top of file instead of inline - Use single-line early returns for clarity - Simplify buildCommentBody with expression chaining - Update JSDoc comments to reflect no-filter behavior - Reduce code by 15 lines while preserving functionality
pelikhan
approved these changes
Feb 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the close safe-output JavaScript handlers to reduce boilerplate and standardize patterns (imports, guard clauses, and comment-body construction) while keeping behavior the same as the recent “comment even if already closed” update.
Changes:
- Hoists
getTrackerID/generateFooterimports to the module top inclose_pull_request.cjs(removing inlinerequire()calls). - Simplifies filter helpers (
checkLabelFilter,checkTitlePrefixFilter) using consistent early-return guard clauses and updates JSDoc to reflect “no filter” behavior. - Simplifies
buildCommentBodyin both files by returning a single concatenated expression.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/close_pull_request.cjs | Consolidates imports and simplifies filter helpers + comment body construction. |
| actions/setup/js/close_entity_helpers.cjs | Applies the same simplifications for shared helper logic (filters + comment body). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Code Simplification - 2026-02-13
This PR simplifies recently modified JavaScript code to improve clarity, consistency, and maintainability while preserving all functionality.
Files Simplified
actions/setup/js/close_pull_request.cjs- Simplified imports and function structureactions/setup/js/close_entity_helpers.cjs- Simplified conditional logic and function chainingImprovements Made
Reduced Complexity
require()statements to top of file (consistent with project patterns)buildCommentBodywith expression chainingEnhanced Clarity
Applied Project Standards
Changes Based On
Recent changes from:
Code Reduction
Testing
make fmt-cjs)make lint-cjs)Review Focus
Please verify:
buildCommentBodyis readableTechnical Details
Import Consolidation (close_pull_request.cjs):
Early Return Pattern:
Expression Chaining:
Automated by Code Simplifier Agent - analyzing code from the last 24 hours