refactor: deduplicate listPullRequestFiles into github/pulls.ts (D-02)

This commit is contained in:
wdawdwa committed 2026-08-23 11:20:16 +08:00
1 parent 5a2e902a9e
commit 941e1d2681
4 files changed
+31 -62

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import type { Octokit } from "@octokit/rest";
import type { PullRequestFile } from "../types.js";
/**
* Shared paginated PR file listing used by the review processor, the PR chat
* snapshot flow, and the webhook context loader.
*/
export async function listPullRequestFiles(
octokit: Octokit,
owner: string,
repo: string,
pullNumber: number
): Promise<PullRequestFile[]> {
const files = await octokit.paginate(octokit.rest.pulls.listFiles, {
owner,
repo,
pull_number: pullNumber,
per_page: 100
});
return files.map((file) => ({
filename: file.filename,
patch: file.patch,
status: file.status,
additions: file.additions,
deletions: file.deletions
}));
}