Skip to content

Fail peer review check when a PR has more than 250 commits - #96

Merged
rafecolton merged 1 commit into
mainfrom
rory-fail-on-250-plus-commits
Aug 7, 2026
Merged

rafecolton merged 1 commit into
mainfrom
rory-fail-on-250-plus-commits

Conversation

@roryabraham

@roryabraham roryabraham commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Details

GitHub's List commits on a pull request endpoint never returns more than 250 commits, no matter how the request is paginated. verifyPeerReview.ts uses that endpoint (via listPullRequestCommits) to determine commit authors/co-authors, so on a PR with more than 250 commits it would silently miss authors past the 250th commit and could pass a review that isn't actually independently reviewed.

This adds a getPullRequestCommitCount helper that reads the commits field off the pull request resource itself (GET /repos/{owner}/{repo}/pulls/{pull_number}), which isn't subject to that 250-commit cap. evaluatePeerReview now checks this count before attempting to determine commit authors, and fails the check with an explanatory error if the PR exceeds 250 commits, asking the author to split the PR into smaller pieces.

Related Issues

Fixes https://github.com/Expensify/Expensify/issues/668527
Handle the 250 commit limitation when inspecting PR commits

Manual Tests

Tested locally (from App repo):

❯ bun repl
Welcome to Bun v1.3.14
Type .copy [code] to copy to clipboard. .help for more info.

❯ const {default: GitHubUtils} = await import('./.github/libs/GithubUtils.ts');
Module {
  default: [class GithubUtils],
}
❯ let pr = await GitHubUtils.octokit.pulls.get({owner: 'Expensify', repo: 'GitHub-Actions', pull_number: 64});
(...full shape omitted...) 
❯ pr.data.commits
115

Linked PRs

N/A

GitHub's List commits on a pull request endpoint never returns more than 250
commits, no matter how it's paginated, so commit authorship (and therefore
peer review) can't be reliably verified above that count.
@roryabraham

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 6aa239a95c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@roryabraham
roryabraham requested a review from rafecolton August 6, 2026 23:48
@roryabraham
roryabraham marked this pull request as ready for review August 6, 2026 23:48

@rafecolton rafecolton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@rafecolton
rafecolton merged commit 661ec2d into main Aug 7, 2026
9 of 10 checks passed
@rafecolton
rafecolton deleted the rory-fail-on-250-plus-commits branch August 7, 2026 22:03
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.

2 participants