fix(sync): paginate compare and resolve real head SHA
This commit is contained in:
@@ -32,8 +32,13 @@ const toStatus = (upstreamAheadBy: number, forkAheadBy: number) => {
|
||||
return 'unknown' as const;
|
||||
};
|
||||
|
||||
const getLastCommitAt = (compare: GitHubCompareSummary) =>
|
||||
compare.commits[compare.commits.length - 1]?.committedAt;
|
||||
const getLastCommitAt = (compare: GitHubCompareSummary) => {
|
||||
const head = compare.commits.find((c) => c.sha === compare.headSha);
|
||||
return (
|
||||
head?.committedAt ??
|
||||
compare.commits[compare.commits.length - 1]?.committedAt
|
||||
);
|
||||
};
|
||||
|
||||
const ensureForkMetadata = (spoon: Doc<'spoons'>) => {
|
||||
if (!spoon.forkOwner || !spoon.forkRepo) {
|
||||
@@ -121,6 +126,7 @@ const refreshOwnedSpoon = async (
|
||||
baseOwner: forkOwner,
|
||||
baseBranch: resolvedForkBranch,
|
||||
headOwner: spoon.upstreamOwner,
|
||||
headRepo: spoon.upstreamRepo,
|
||||
headBranch: upstreamBranch,
|
||||
}),
|
||||
compareAcrossForkNetwork(octokit, {
|
||||
@@ -129,6 +135,7 @@ const refreshOwnedSpoon = async (
|
||||
baseOwner: spoon.upstreamOwner,
|
||||
baseBranch: upstreamBranch,
|
||||
headOwner: forkOwner,
|
||||
headRepo: forkRepo,
|
||||
headBranch: resolvedForkBranch,
|
||||
}),
|
||||
listPullRequests(octokit, { owner: forkOwner, repo: forkRepo }),
|
||||
|
||||
Reference in New Issue
Block a user