Skip to content

fix: improve GitHub rate limit error handling#557

Open
yChandrakala23 wants to merge 1 commit into
JhaSourav07:mainfrom
yChandrakala23:fix-github-rate-limit-handling
Open

fix: improve GitHub rate limit error handling#557
yChandrakala23 wants to merge 1 commit into
JhaSourav07:mainfrom
yChandrakala23:fix-github-rate-limit-handling

Conversation

@yChandrakala23
Copy link
Copy Markdown

Description

Fixes #536

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

Not applicable — backend/API error handling change.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 27, 2026

@yChandrakala23 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

👋 Hey @yChandrakala23, welcome to CommitPulse! 🎉

Thanks for opening your first pull request — this is a big deal and we appreciate the effort!

While you wait for a review, please double-check:

  • ✅ You've read the CONTRIBUTING.md checklist
  • npm run lint, npm run format, and npm run test all pass locally
  • ✅ Your PR has a visual preview if it touches any SVG output
  • 💬 You've joined our Discord for faster PR feedback

A maintainer will review your PR shortly. Hang tight! 🚀

@yChandrakala23
Copy link
Copy Markdown
Author

Hi maintainers, all required CI checks are passing on my side. The only failing check is Vercel deployment authorization, which seems to require project-level access. Please let me know if anything else is needed from my end.

@github-actions github-actions Bot added the type:bug Something isn't working as expected label May 27, 2026
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

The author added a handful of well-typed helpers in lib/github.ts to detect 403 and 429 responses by checking the x-ratelimit-remaining header, then wired them into all three GitHub API call sites plus the contributors page. The error messages actually tell you when the limit resets and suggest setting up GITHUB_TOKEN, which is nice. Only tiny thing is that the rate limit headers get parsed twice when an error actually fires, once to decide to throw and again inside the error builder, but that's more of a shrug than a problem. The branch has some unrelated cruft from other PRs, but the author's own commit is clean and focused.

@yChandrakala23
Copy link
Copy Markdown
Author

Hi @Aamod007, thank you for the detailed review!

I checked the branch locally, and the PR currently contains only the intended rate-limit handling changes:

  • lib/github.ts
  • app/contributors/page.tsx

git diff main...HEAD --stat shows only these 2 files changed. Please let me know if there is any specific unrelated change you want me to remove or adjust.

@github-actions github-actions Bot added the needs-rebase This PR has merge conflicts and needs a rebase. label May 28, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Hey @yChandrakala23, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown

⚠️ Hey @yChandrakala23, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase This PR has merge conflicts and needs a rebase. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add GitHub API rate-limit monitoring and warning indicator

2 participants