refactor: extract bot inactivity comment builders to bot-inactivity-comments.js#1654
Open
utkarsh232005 wants to merge 1 commit into
Open
Conversation
…omments.js Resolves hiero-ledger#1598 The four comment builder functions (buildWarningComment, buildClosureComment, buildLinkedPRClosedComment, buildBlockedCheckinComment) and the two HTML marker constants (WARN_MARKER, BLOCKED_CHECKIN_MARKER) have been moved from bot-inactivity.js into a new sibling file bot-inactivity-comments.js. This follows the established *.js <-> *-comments.js pattern used by the commands/ bots (assign, finalize, unassign), making the inactivity bot consistent with the rest of the bot system. Changes: - Create .github/scripts/bot-inactivity-comments.js with SPDX header, the two HTML markers, and all four builder functions exported via module.exports. - Update buildWarningComment and buildClosureComment signatures to accept duration values (warnAfterMs, closeAfterMs) as parameters instead of reading module-level constants, keeping WARN_AFTER_MS, CLOSE_AFTER_MS, and BLOCKED_CHECKIN_AFTER_MS as a single source of truth in bot-inactivity.js. - Replace inline definitions in bot-inactivity.js with a require('./bot-inactivity-comments') import. - Update call sites in handleStaleItem to pass the duration constants into the builders. All 34 existing tests in tests/test-inactivity-bot.js continue to pass without modification. ESLint is clean. No behavioral change. Signed-off-by: utkarsh patrikar <utkarshpatrikar@gmail.com>
|
Hey @utkarsh232005 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ✅ GPG Signature -- All commits have verified GPG signatures. Locked and loaded! ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ✅ Issue Link -- Linked to #1598 (assigned to you). 🎉 All checks passed! Your PR is ready for review. Great job! |
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
Resolves #1598
The four comment builder functions (, , , ) and the two HTML marker constants (, ) have been moved from
bot-inactivity.jsinto a new sibling filebot-inactivity-comments.js.This follows the established
*.js↔*-comments.jspattern used by thecommands/bots (assign, finalize, unassign), making the inactivity bot consistent with the rest of the bot system.Changes
.github/scripts/bot-inactivity-comments.jswith SPDX header, the two HTML markers, and all four builder functions exported viamodule.exports.buildWarningCommentandbuildClosureCommentsignatures to accept duration values (warnAfterMs,closeAfterMs) as parameters instead of reading module-level constants, keepingWARN_AFTER_MS,CLOSE_AFTER_MS, andBLOCKED_CHECKIN_AFTER_MSas a single source of truth inbot-inactivity.js.bot-inactivity.jsto replace inline definitions with arequire('./bot-inactivity-comments')import.handleStaleItemto pass the duration constants into the builders.Verification
tests/test-inactivity-bot.jspass without modification.Checklist
.github/scripts/bot-inactivity-comments.jsexists at the top level, colocated withbot-inactivity.jsbot-inactivity.jsimports them and no longer defines them inlineWARN_AFTER_MS,CLOSE_AFTER_MS,BLOCKED_CHECKIN_AFTER_MS) remain inbot-inactivity.js