-
Notifications
You must be signed in to change notification settings - Fork 148
Add pagination to bot-detection API calls with 500-item cap #15318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: mnkiefer <[email protected]>
Co-authored-by: mnkiefer <[email protected]>
Co-authored-by: mnkiefer <[email protected]>
Co-authored-by: mnkiefer <[email protected]>
…ectly Co-authored-by: mnkiefer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the bot-detection workflow to reliably gather PR activity on high-volume PRs by switching from single-page REST calls to bounded pagination, ensuring the detector considers more complete comment/review/file data.
Changes:
- Replace single-page GitHub API calls with
github.paginatefor PR issue comments, review comments, reviews, and file lists (capped at 500 items per call). - Regenerate the compiled workflow (
bot-detection.lock.yml) to reflect the updated source workflow (bot-detection.md). - Includes unrelated changes: a Smoke Copilot cron minute adjustment and minor formatting/quote tweaks in a JS utility.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/bot-detection.md |
Switches bot-detection API fetches to bounded pagination (500-item cap) for determinism on noisy PRs. |
.github/workflows/bot-detection.lock.yml |
Regenerated compiled workflow reflecting the new pagination logic. |
.github/workflows/smoke-copilot.lock.yml |
Changes the scheduled cron minute for the Smoke Copilot workflow (appears unrelated to bot-detection pagination). |
actions/setup/js/merge_remote_agent_github_folder.cjs |
Minor formatting/quote changes in path validation logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const remaining = 500 - total; | ||
| if (remaining <= 0) { | ||
| done(); | ||
| return []; | ||
| } | ||
| if (total + response.data.length >= 500) { | ||
| total = 500; |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cap value 500 is hard-coded multiple times inside this pagination callback (and repeated across the other paginate calls). Consider defining a single constant (e.g., MAX_PAGINATE_ITEMS) and referencing it here to avoid inconsistencies if the cap ever changes, and to reduce duplicated magic numbers across the script.
| schedule: | ||
| - cron: "37 */12 * * *" | ||
| - cron: "46 */12 * * *" | ||
| workflow_dispatch: null |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is described as only adding pagination to bot-detection API calls, but it also changes the Smoke Copilot workflow schedule cron (and includes other unrelated edits in the diff). If this cron change is intentional, please update the PR description accordingly (or split into a separate PR). Also, since this is a generated *.lock.yml file, ensure the change is reproducible from the corresponding .md source via gh aw compile, otherwise it may get overwritten later.
The bot-detection workflow was using single-page API calls (
per_page: 100) for comments, reviews, and files, missing activity on noisy/abused PRs—exactly the scenario this detector should catch.Changes
github.paginate: All four calls (issues.listComments,pulls.listReviewComments,pulls.listReviews,pulls.listFiles) now paginate with explicit 500-item cap for determinismImplementation
The callback pattern ensures exact cap enforcement by calculating remaining capacity before each page, checking totals before updates, and slicing using the pre-calculated remaining value.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.