fix: paginate bulk-scan organization selection - #148
Open
GautamSharma99 wants to merge 1 commit into
Open
Conversation
rajpratham1
approved these changes
Jul 30, 2026
rajpratham1
left a comment
There was a problem hiding this comment.
This pull request improves bulk scan organization selection by replacing the single-page organization lookup with paginated retrieval, ensuring users with more than 100 GitHub organizations can discover all available accounts. The implementation also deduplicates organization names across pages while preserving the original casing, and checks for cancellation during pagination so aborted operations terminate cleanly before repository discovery begins. The accompanying tests verify multi-page retrieval, deduplication, pagination behavior, and cancellation handling. Based on the visible changes, the implementation addresses the stated limitation without introducing any apparent blocking issues.
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
Fixes #135.
The interactive bulk-scan wizard now loads every page returned by
GET /user/orgsbefore asking which account to scan. Previously it requested onlyper_page: 100, so organization memberships after the first page were silently absent from the selector.Changes
REST pagination
Organization discovery now follows GitHub REST pagination one page at a time:
Linkheader forrel="next";This works through the same Octokit request boundary for GitHub.com and configured GitHub Enterprise hosts.
Cancellation
The campaign abort signal is forwarded to every organization-page request. It is also checked:
Cancellation therefore stops pagination without requesting another page, opening the selector, or starting repository discovery.
Account normalization
The combined personal-account and organization list is deduplicated case-insensitively before sorting. This prevents duplicate selector entries if repeated organization memberships appear across pages while preserving the login spelling returned by GitHub.
The authenticated personal account remains available alongside all organizations.
Tests
Added a paginated REST fixture and regression coverage that verifies:
Existing single-page organization selection, GitHub Enterprise, repository pagination, authentication, and cancellation tests continue to pass.
Verification
pnpm run typespnpm run formatpnpm run buildPATH="/opt/homebrew/bin:$PATH" pnpm run testFull suite: 472 passed, 6 expected platform/integration skips, 0 failed.