feat: Add Issue Link Checking to PR Helper Bot#1201
Merged
Conversation
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
4 tasks
gsstoykov
previously approved these changes
Mar 4, 2026
gsstoykov
approved these changes
Mar 5, 2026
PavelSBorisov
approved these changes
Mar 5, 2026
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
This PR adds issue link checking as a fourth validation check to the PR Helper Bot, ensuring every PR references at least one issue and that the PR author is assigned to all linked issues. Alongside this new feature, the bot architecture is refactored from a fragmented multi-step/multi-comment design into a unified single-comment dashboard with modular, independently testable helper modules.
Key Changes:
closingIssuesReferencesfallbackchecks.js,comments.js,api.js)on-commit+on-prtwo-step workflow into dedicatedon-pr-openandon-pr-updateworkflowsMotivation
Previously the bot ran DCO, GPG, and merge conflict checks independently, each posting its own comment on failure. There was no mechanism to verify that a PR was linked to a tracked issue, making it easy for contributions to bypass the issue-first workflow. The fragmented architecture also made testing and maintenance difficult.
This change:
Changes
1. Issue Link Check (New) ⭐
The core addition.
checkIssueLinkinhelpers/checks.jsvalidates that a PR references at least one issue and that the author is assigned to each linked issue.Detection strategy:
closes,fixes,resolves) andrelated toreferencesclosingIssuesReferencesif the regex finds nothingPossible outcomes:
Files:
helpers/checks.js--checkIssueLink()functionhelpers/api.js--fetchIssue(),fetchClosingIssueNumbers()API wrappers2. Unified Dashboard Comment
Replaced per-check individual comments with a single bot comment that renders all four checks together. The comment is identified by an HTML marker (
<!-- bot:pr-helper -->) and is created on first run, then updated in place on subsequent events.Comment structure:
### PR Checkssection with DCO, GPG, Merge Conflict, and Issue Link results separated by horizontal rulesFiles:
helpers/comments.js--buildBotComment(),buildChecksSection(), and per-check section buildershelpers/api.js--postOrUpdateComment()with pagination to find existing bot comment3. Modular Architecture Refactor
Broke the monolithic
bot-on-commit.jsandbot-on-pr.jsinto focused modules:bot-on-commit.js(deleted)helpers/checks.jsbot-on-commit.js(deleted)helpers/api.jsfetchPRCommits,runAllChecksAndCommentbot-on-pr.js(deleted)bot-on-pr-open.jsbot-on-pr-update.jshelpers/comments.jsCheck functions in
checks.jsare pure (no API calls, no side effects), making them trivially testable. API interactions are isolated inapi.js.4. Workflow Changes
on-pr.yamlrenamed toBot - On PR Open, simplified from a two-step job (on-commit then on-pr with env-var passing) to a single step callingbot-on-pr-open.json-pr-update.yaml(new) replaceson-commit.yaml, triggers onsynchronizeandeditedevents, callsbot-on-pr-update.json-commit.yamldeletedpr-bot-${{ number }}) to prevent race conditions5. Test Infrastructure Overhaul
Replaced the old
test-on-commit-bot.jsandtest-on-pr-bot.jswith a comprehensive suite of focused test files:tests/test-checks.jstests/test-comments.jstests/test-api.jsbuildBotContext,postOrUpdateComment, labels, etc.tests/test-on-pr-open-bot.jsbot-on-pr-open.jsintegrationtests/test-on-pr-update-bot.jsbot-on-pr-update.jsintegrationtests/test-assign-bot.jsscripts/totests/Shared utilities (
tests/test-utils.js) provide commit helpers, acreateMockGithubfactory with issue/GraphQL support, comment snapshot verification, and arunTestSuiterunner with summary printing.Testing
Test Plan:
zxc-test-bot-scripts.yaml) updated to run all new test filesFiles Changed Summary
Added (8 files)
.github/scripts/bot-on-pr-open.js-- PR open handler.github/scripts/bot-on-pr-update.js-- PR update handler.github/scripts/helpers/checks.js-- Pure check functions.github/scripts/helpers/comments.js-- Dashboard comment builder.github/scripts/tests/test-checks.js-- Check unit tests.github/scripts/tests/test-comments.js-- Comment unit tests.github/scripts/tests/test-api.js-- API helper tests.github/scripts/tests/test-on-pr-open-bot.js-- On-PR-open integration tests.github/scripts/tests/test-on-pr-update-bot.js-- On-PR-update integration tests.github/workflows/on-pr-update.yaml-- New PR update workflowModified (4 files)
.github/scripts/helpers/api.js-- AddedfetchIssue,fetchClosingIssueNumbers,postOrUpdateComment,runAllChecksAndComment,swapStatusLabel.github/scripts/helpers/index.js-- Re-exports new modules.github/scripts/tests/test-utils.js-- AddedcreateMockGithubfactory with issue/GraphQL mocking.github/workflows/on-pr.yaml-- Renamed and simplified to single-step.github/workflows/zxc-test-bot-scripts.yaml-- Updated to run all new test filesRemoved (4 files)
.github/scripts/bot-on-commit.js-- Replaced by modular checks +bot-on-pr-update.js.github/scripts/bot-on-pr.js-- Replaced bybot-on-pr-open.js.github/scripts/test-on-commit-bot.js-- Replaced bytests/test-checks.jset al..github/scripts/test-on-pr-bot.js-- Replaced bytests/test-on-pr-open-bot.jset al..github/workflows/on-commit.yaml-- Replaced byon-pr-update.yamlBreaking Changes
None. All changes are internal to the CI bot infrastructure. No public SDK APIs are affected. The bot comment format changes from multiple individual comments to a single dashboard comment, but this is a UX improvement with no downstream impact.