Skip to content

feat: add GitHub Sponsors integration — show sponsor badge on leaderb…#1265

Closed
VIDYANKSHINI wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
VIDYANKSHINI:feat/github-sponsors
Closed

feat: add GitHub Sponsors integration — show sponsor badge on leaderb…#1265
VIDYANKSHINI wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
VIDYANKSHINI:feat/github-sponsors

Conversation

@VIDYANKSHINI
Copy link
Copy Markdown
Contributor

Summary

This PR implements the GitHub Sponsors integration. It adds a background synchronization process that fetches the current GitHub Sponsors for the project via the GraphQL API, and prominently displays a SponsorBadge on the Leaderboard, Public Profiles, and the Landing Page's contributors section.

Closes #1055

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Database: Added an is_sponsor boolean column to the users table via migration 20260527000000_add_is_sponsor.sql.
  • API & Cron: Created /api/sponsors/sync to query the GitHub GraphQL API for the maintainer's sponsorships and update the database. This is scheduled to run daily in vercel.json.
  • UI Component: Created a reusable, accessible <SponsorBadge /> (💎 Sponsor) with a tooltip thanking the sponsor.
  • Leaderboard: Updated the API and page to render the sponsor badge next to the username.
  • Public Profile: Display the sponsor badge next to the user's name on their public profile page.
  • Landing Page: Contributors fetched from the GitHub API are mapped against our database's sponsors. Active sponsors get a pink highlight ring around their avatar and a (Sponsor 💎) indicator in the tooltip.

How to Test

  1. Apply the database migration (supabase db push or run the SQL in dashboard).
  2. Manually trigger a GET request to /api/sponsors/sync using a valid CRON_SECRET or in development mode.
  3. Check the users table to ensure is_sponsor is set to true for matching sponsors.
  4. Visit the Leaderboard and Public Profiles of the sponsored users to see the badge.
  5. Check the Landing Page contributors section to see the highlighted avatars.

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

Copilot AI review requested due to automatic review settings May 27, 2026 09:40
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@VIDYANKSHINI is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:docs GSSoC type bonus: documentation (+5 pts) type:feature GSSoC type bonus: new feature labels May 27, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds GitHub Sponsor support by persisting sponsor status in Supabase, syncing it via a scheduled API route, and surfacing sponsor badges in UI (public profile, leaderboard, landing contributors).

Changes:

  • Adds is_sponsor column to users (schema + migration) and selects/uses it in Supabase queries.
  • Introduces a /api/sponsors/sync cron endpoint and schedules it in vercel.json.
  • Displays sponsor status via a new SponsorBadge component across multiple pages.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vercel.json Schedules the new sponsors sync cron route.
supabase/schema.sql Adds is_sponsor to the users table schema.
supabase/migrations/20260527000000_add_is_sponsor.sql Migration to add is_sponsor to existing DBs.
src/lib/supabase.ts Extends user selection/types to include is_sponsor.
src/lib/public-profile-data.ts Adds isSponsor to the public profile payload shape.
src/components/landing/LandingPage.tsx Highlights sponsors in contributor avatars (border/title).
src/components/SponsorBadge.tsx New reusable sponsor badge component.
src/app/u/[username]/page.tsx Shows sponsor badge on public profile.
src/app/page.tsx Marks landing contributors as sponsors via Supabase lookup.
src/app/leaderboard/page.tsx Shows sponsor badge on leaderboard entries.
src/app/api/sponsors/sync/route.ts New endpoint to sync sponsor list from GitHub GraphQL into Supabase.
src/app/api/leaderboard/route.ts Adds sponsor flag into leaderboard API payload.
pr_body.md PR description file added (but does not match the actual code changes).
Comments suppressed due to low confidence (1)

src/app/page.tsx:1

  • GitHub logins are case-insensitive, but Postgres IN matching (and Set.has) is case-sensitive. If users.github_login casing differs from GitHub’s API response casing, sponsors won’t be detected. Normalize both sides (e.g., store a canonical lowercase login, or compare using lowercase in the query and in sponsorSet).
import ParticleBackground from "@/components/ParticleBackground";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pr_body.md Outdated
Comment on lines +3 to +5
This PR implements the per-repository commit heatmap functionality inside the Top Repos widget. Clicking a repository name now opens a drawer with a 90-day mini contribution heatmap and relevant metrics.

Closes #943
Comment on lines +6 to +10
export async function GET(req: Request) {
const authHeader = req.headers.get("authorization");
if (authHeader !== `Bearer ${process.env.CRON_SECRET}` && process.env.NODE_ENV !== "development") {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
Comment thread src/app/api/sponsors/sync/route.ts Outdated
Comment on lines +54 to +58
const { data } = await res.json();

const sponsorLogins: string[] = [];

if (data?.user?.sponsorshipsAsMaintainer?.nodes) {
Comment thread src/app/api/sponsors/sync/route.ts Outdated
Comment on lines +67 to +79
// Reset all is_sponsor to false
await supabaseAdmin
.from("users")
.update({ is_sponsor: false })
.neq("is_sponsor", false);

// Set is_sponsor = true for active sponsors
if (sponsorLogins.length > 0) {
await supabaseAdmin
.from("users")
.update({ is_sponsor: true })
.in("github_login", sponsorLogins);
}
Comment thread src/components/SponsorBadge.tsx Outdated
title="GitHub Sponsor — thank you for supporting DevTrack!"
aria-label="GitHub Sponsor"
>
💎 Sponsor
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Thanks @ionfwsrijan for the GitHub Sponsors integration! The sponsor sync, SponsorBadge component, and leaderboard/profile integration all look great. However, there's one file that needs to be removed before we can merge:

pr_body.md — A file named pr_body.md was accidentally committed to the repo root. Please remove this file from your branch and push again.

Once that's fixed, we'll be happy to merge!

@ionfwsrijan
Copy link
Copy Markdown
Contributor

@Priyanshu-byte-coder Sir this pr wasnt raised by my. You may close this. Wait for me to raise a PR as this issue is raised by me

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Hi @VIDYANKSHINI! The GitHub Sponsors integration looks great overall! However, there's still a pr_body.md file at the repository root that shouldn't be committed — please remove it and push. Once that's removed, this can be merged. Thanks!

@VIDYANKSHINI VIDYANKSHINI force-pushed the feat/github-sponsors branch 2 times, most recently from 4d84ed6 to 06138cf Compare May 28, 2026 12:40
@VIDYANKSHINI
Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder,

Thanks for the review! I've removed the pr_body.md file as requested. I also took care of the other lint/TypeScript issues and Copilot review comments in my latest commits. Let me know if everything looks good to merge now!

@VIDYANKSHINI VIDYANKSHINI force-pushed the feat/github-sponsors branch from 0c6ad48 to f175d2a Compare May 28, 2026 12:53
@github-actions github-actions Bot added the type:testing GSSoC type bonus: tests (+10 pts) label May 28, 2026
Priyanshu-byte-coder added a commit that referenced this pull request May 28, 2026
…oard (#1265)

Co-authored-by: VIDYANKSHINI <VIDYANKSHINI@users.noreply.github.com>
@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level:intermediate GSSoC: Intermediate difficulty (35 pts) labels May 28, 2026
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Merged manually via squash commit in main. Thanks for the contribution!

@VIDYANKSHINI
Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder,

Thank you so much for merging the PR manually!

I just had a quick question — since the PR is showing up as "Closed" rather than "Merged" on GitHub due to the manual squash commit, will the GSSoC bot still track it correctly for points based on the labels (gssoc:approved and level:intermediate)?

Just wanted to double-check to be sure. Thanks again for your guidance!

KrutagyaKaneria pushed a commit to KrutagyaKaneria/devtrack that referenced this pull request May 28, 2026
…oard (Priyanshu-byte-coder#1265)

Co-authored-by: VIDYANKSHINI <VIDYANKSHINI@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:docs GSSoC type bonus: documentation (+5 pts) type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add GitHub Sponsors integration — show sponsor badge on leaderboard

4 participants