feat: add GitHub Sponsors integration — show sponsor badge on leaderb…#1265
feat: add GitHub Sponsors integration — show sponsor badge on leaderb…#1265VIDYANKSHINI wants to merge 4 commits into
Conversation
|
@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. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
There was a problem hiding this comment.
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_sponsorcolumn tousers(schema + migration) and selects/uses it in Supabase queries. - Introduces a
/api/sponsors/synccron endpoint and schedules it invercel.json. - Displays sponsor status via a new
SponsorBadgecomponent 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
INmatching (andSet.has) is case-sensitive. Ifusers.github_logincasing 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 insponsorSet).
import ParticleBackground from "@/components/ParticleBackground";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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 |
| 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 }); | ||
| } |
| const { data } = await res.json(); | ||
|
|
||
| const sponsorLogins: string[] = []; | ||
|
|
||
| if (data?.user?.sponsorshipsAsMaintainer?.nodes) { |
| // 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); | ||
| } |
| title="GitHub Sponsor — thank you for supporting DevTrack!" | ||
| aria-label="GitHub Sponsor" | ||
| > | ||
| 💎 Sponsor |
|
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:
Once that's fixed, we'll be happy to merge! |
|
@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 |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
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!
4d84ed6 to
06138cf
Compare
|
Thanks for the review! I've removed the |
0c6ad48 to
f175d2a
Compare
…oard (#1265) Co-authored-by: VIDYANKSHINI <VIDYANKSHINI@users.noreply.github.com>
|
Merged manually via squash commit in main. Thanks for the contribution! |
|
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 ( Just wanted to double-check to be sure. Thanks again for your guidance! |
…oard (Priyanshu-byte-coder#1265) Co-authored-by: VIDYANKSHINI <VIDYANKSHINI@users.noreply.github.com>
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
SponsorBadgeon the Leaderboard, Public Profiles, and the Landing Page's contributors section.Closes #1055
Type of Change
Changes Made
is_sponsorboolean column to theuserstable via migration20260527000000_add_is_sponsor.sql./api/sponsors/syncto query the GitHub GraphQL API for the maintainer's sponsorships and update the database. This is scheduled to run daily invercel.json.<SponsorBadge />(💎 Sponsor) with a tooltip thanking the sponsor.(Sponsor 💎)indicator in the tooltip.How to Test
supabase db pushor run the SQL in dashboard)./api/sponsors/syncusing a validCRON_SECRETor in development mode.userstable to ensureis_sponsoris set totruefor matching sponsors.Checklist
npm run lintpasses locallynpm run type-check)