Skip to content

fix(github): paginate listCommits to return all PR commits#836

Merged
kitsuyui merged 1 commit into
mainfrom
fix/audit-getcommitids-no-pagination-001
May 27, 2026
Merged

fix(github): paginate listCommits to return all PR commits#836
kitsuyui merged 1 commit into
mainfrom
fix/audit-getcommitids-no-pagination-001

Conversation

@kitsuyui

Copy link
Copy Markdown
Owner

Summary

  • getCommitIds called pulls.listCommits without per_page or pagination, so only the first 30 commits (GitHub's default) were returned
  • PRs with more than 30 commits silently dropped later commits from rule evaluation, making lucky-commit matching non-deterministic
  • Switch to octokit.paginate with per_page: 100 so all pages are fetched regardless of PR size

Changes

  • src/github.ts: replace octokit.pulls.listCommits with octokit.paginate(octokit.pulls.listCommits, { per_page: 100 })
  • src/github.spec.ts: update mock and assertion to use paginate; add a test for multi-page commit lists
  • dist/: rebuilt

Test plan

  • All 47 tests pass (bun run test)
  • biome check passes with no fixes applied
  • madge --circular src/ reports no circular dependencies
  • Build succeeds (bun run build)

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

🎉 Happy commit!

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

gh-counter

PR gate

Removed Added +/-
TODO/FIXME 0 0 0

Repo dashboard

main (98984a1) #836 (e79986c) +/-
TODO/FIXME 0 0 0

Reported by gh-counter

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

Code Metrics Report

main (fd2ef70) #836 (e79986c) +/-
Coverage 99.1% 99.2% +0.0%
Code to Test Ratio 1:0.5 1:0.5 -0.1
Test Execution Time 1s 1s 0s
Details
  |                     | main (fd2ef70) | #836 (e79986c) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | 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 |           1630 |   +32 |
+ |   Test              |            898 |            912 |   +14 |
  | Test Execution Time |             1s |             1s |    0s |

Code coverage of files in pull request scope (100.0% → 100.0%)

Files Coverage +/- Status
src/github.ts 100.0% 0.0% modified

Reported by octocov

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown

gh-build-size

Target main #836 +/-
Total action artifacts 23,300,320 B 23,300,369 B +49 B
Runtime bundle 1,153,633 B 1,153,652 B +19 B
Source maps 17,130,662 B 17,130,692 B +30 B

Reported by gh-build-size

getCommitIds called pulls.listCommits without per_page or pagination,
so only the first 30 commits were returned. PRs with more than 30
commits silently dropped later commits from rule evaluation.

Switch to octokit.paginate so all pages are fetched, matching the
existing per_page: 100 pattern used for comment listing.
@kitsuyui
kitsuyui force-pushed the fix/audit-getcommitids-no-pagination-001 branch from 78d6bb9 to a6303b3 Compare May 26, 2026 14:19
@kitsuyui
kitsuyui merged commit 5e1e87b into main May 27, 2026
5 checks passed
@kitsuyui
kitsuyui deleted the fix/audit-getcommitids-no-pagination-001 branch May 27, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant