fix(github): paginate listComments to find managed comment beyond first page#835
Merged
Merged
Conversation
🎉 Happy commit!
|
gh-counterPR gate
Repo dashboard
Reported by gh-counter |
Code Metrics Report
Details | | main (fd2ef70) | #835 (8235eb2) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 99.1% | 99.2% | +0.0% |
| Files | 5 | 5 | 0 |
| Lines | 122 | 131 | +9 |
+ | Covered | 121 | 130 | +9 |
- | Code to Test Ratio | 1:0.5 | 1:0.5 | -0.1 |
| Code | 1598 | 1616 | +18 |
+ | Test | 898 | 899 | +1 |
| Test Execution Time | 1s | 1s | 0s |Code coverage of files in pull request scope (100.0% → 100.0%)
Reported by octocov |
…st page Previously getManagedComment called listComments once with per_page=100, missing any managed comment that appeared after the first 100 entries. On PRs with many comments this caused repeated duplicate comment creation. Extract listAllComments to fetch all pages iteratively, then search the full result in getManagedComment. Each function stays within the cognitive-complexity limit enforced by biome.
13766ec to
071dfc4
Compare
The test job was failing on `git diff --exit-code -- dist` because dist/ was not regenerated after the src/github.ts pagination refactor in this PR. Running `bun run build` produces three updated files (github.mjs, its map, and github.d.mts.map). All 46 tests pass.
gh-build-size
Reported by gh-build-size |
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
getManagedCommentpreviously calledlistCommentsonce withper_page: 100, missing any managed comment that appeared after the first 100 entriesdecideCommentActionto seenullas the past comment and repeatedly create duplicate managed commentslistAllCommentsto iterate through all pages, then search the complete result ingetManagedCommentValidation
biome checkpasses (each new function stays within the cognitive-complexity limit of 3)madge --circular src/reports no circular dependenciesNotes
The
listAllCommentshelper stops fetching once a page returns fewer than 100 items, which signals the last page.getManagedCommentitself is unchanged in shape — it still returns the first managed comment by the given user, ornull.