Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read more than 100 commits from GitHub API #39

Open
Balastrong opened this issue Sep 2, 2024 · 0 comments
Open

Read more than 100 commits from GitHub API #39

Balastrong opened this issue Sep 2, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@Balastrong
Copy link
Owner

The initial naive implementation works fine, but hits the hard limit of 100 items per page. At some point we should implement a more reliable solution to read all commits in the desired timeframe (will probably remain 365 days)

export const getUserRepoStats = unstable_cache(
(
octokit: Octokit,
userLogin: string,
repoOwner: string,
repoName: string,
) => {
const today = new Date()
return octokit.rest.repos.listCommits({
owner: repoOwner,
repo: repoName,
author: userLogin,
per_page: 100,
since: new Date(today.setDate(today.getDate() - 365)).toISOString(),
})
},
undefined,
{ revalidate: 600 },
)

@Balastrong Balastrong added the help wanted Extra attention is needed label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant