Skip to content

feat: add pinned repositories support to user profile - #474

Merged
PRODHOSH merged 1 commit into
PRODHOSH:mainfrom
mspandey:patch-4
Jul 17, 2026
Merged

feat: add pinned repositories support to user profile#474
PRODHOSH merged 1 commit into
PRODHOSH:mainfrom
mspandey:patch-4

Conversation

@mspandey

@mspandey mspandey commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Partially Resolves #146

📝 Description

This PR updates the profile page to respect a user's curated GitHub profile by fetching and displaying their "Pinned repositories." Previously, the application only displayed popular repositories by star count, which ignored user curation.

🛠️ Changes Made

  • GraphQL Query Updated: Added pinnedItems(first: 6, types: REPOSITORY) to CONTRIBUTOR_QUERY in src/lib/github.ts.
  • TypeScript Types Updated: Expanded the GitHubContributor interface to properly type the incoming pinnedItems nodes.
  • UI Fallback Logic Added: The profile page now checks for pinned repositories first. If the user has pinned items, they are displayed under a "Pinned repositories" heading. If none exist, it gracefully falls back to the original "Popular repositories" display.

✅ Definition of Done

  • Pinned repos appear in a labeled section when the user has them.
  • Falls back to popular repos when nothing is pinned.
  • TypeScript types are updated.
  • PR is linked to the original issue.

Summary by CodeRabbit

  • New Features
    • Contributor profiles now include up to six pinned repositories.
    • Pinned repository details include names, descriptions, star and fork counts, primary languages, and links.

Partially Resolves PRODHOSH#146

### 📝 Description
This PR updates the profile page to respect a user's curated GitHub profile by fetching and displaying their "Pinned repositories." Previously, the application only displayed popular repositories by star count, which ignored user curation. 

### 🛠️ Changes Made
* **GraphQL Query Updated:** Added `pinnedItems(first: 6, types: REPOSITORY)` to `CONTRIBUTOR_QUERY` in `src/lib/github.ts`.
* **TypeScript Types Updated:** Expanded the `GitHubContributor` interface to properly type the incoming `pinnedItems` nodes.
* **UI Fallback Logic Added:** The profile page now checks for pinned repositories first. If the user has pinned items, they are displayed under a "Pinned repositories" heading. If none exist, it gracefully falls back to the original "Popular repositories" display.

### ✅ Definition of Done
- [x] Pinned repos appear in a labeled section when the user has them.
- [x] Falls back to popular repos when nothing is pinned.
- [x] TypeScript types are updated.
- [x] PR is linked to the original issue.
Copilot AI review requested due to automatic review settings July 17, 2026 12:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to OSSfolio, @mspandey! 🎉

Thank you for opening this pull request and contributing to the open-source community! 🚀

To ensure a smooth review process, please make sure you have:

  • Checked that your changes work locally and compile cleanly.
  • Followed the guidelines outlined in CONTRIBUTING.md.
  • Linked your PR to an open issue (e.g. Closes #ISSUE_NUMBER).

We will review your PR as soon as possible. Happy coding! 💻✨

@github-actions github-actions Bot added the backend API / Database / Server label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

GitHub contributor queries now retrieve up to six pinned repositories, and GitHubContributor exposes their metadata. Contribution calendar parsing receives formatting-only adjustments.

Changes

Contributor data updates

Layer / File(s) Summary
Pinned repository query and type contract
src/lib/github.ts
The contributor GraphQL query requests pinned repository metadata, and GitHubContributor defines the corresponding pinnedItems.nodes structure.
Calendar parser formatting
src/lib/github.ts
The weekMap object literal and trailing closing brace are reformatted without changing calendar values or logic.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: frontend, UI, completed

Suggested reviewers: copilot, adit-jain-srm, debasmitabose0

Poem

A bunny saw six repos in a row,
With stars and forks all set to show.
The query hopped, the types agreed,
While calendar lines gained tidy speed.
“Neat!” cried the rabbit, ears held high.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR updates the GraphQL query and types, but the pinned-repo profile UI and popular-repo fallback required by [#146] are not shown. Add the profile-page UI to render pinned repos in the existing card layout, and fall back to popular repositories when none are pinned.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding pinned repositories support to user profiles.
Out of Scope Changes check ✅ Passed No meaningful out-of-scope changes are evident; the extra scraper edit appears to be a harmless formatting-only tweak.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/github.ts`:
- Around line 103-114: Update the types argument in the pinnedItems query to use
GraphQL list syntax, wrapping REPOSITORY in brackets to match the expected
[PinnableItemType!] type. Leave the rest of the pinnedItems selection unchanged.
- Around line 165-174: Update fetchContributorProfile to bump the Redis cache
key version, invalidating profiles cached before the required pinnedItems field
was added. Keep pinnedItems required and ensure all newly fetched profiles use
the new cache key so downstream access to pinnedItems.nodes remains safe.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 389dc0bc-0c98-4ca0-bfec-9afbf8a64c4f

📥 Commits

Reviewing files that changed from the base of the PR and between 59bd897 and 3944ce6.

📒 Files selected for processing (1)
  • src/lib/github.ts

Comment thread src/lib/github.ts
Comment on lines +103 to +114
pinnedItems(first: 6, types: REPOSITORY) {
nodes {
... on Repository {
name
description
stargazerCount
forkCount
primaryLanguage { name color }
url
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use list syntax for the types argument.

While GraphQL engines gracefully coerce single values into lists, the types argument on pinnedItems strictly expects a list of enums ([PinnableItemType!]). It is safer and more idiomatic to use list syntax to prevent potential parser warnings.

♻️ Proposed refactor
-      pinnedItems(first: 6, types: REPOSITORY) {
+      pinnedItems(first: 6, types: [REPOSITORY]) {
         nodes {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pinnedItems(first: 6, types: REPOSITORY) {
nodes {
... on Repository {
name
description
stargazerCount
forkCount
primaryLanguage { name color }
url
}
}
}
pinnedItems(first: 6, types: [REPOSITORY]) {
nodes {
... on Repository {
name
description
stargazerCount
forkCount
primaryLanguage { name color }
url
}
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/github.ts` around lines 103 - 114, Update the types argument in the
pinnedItems query to use GraphQL list syntax, wrapping REPOSITORY in brackets to
match the expected [PinnableItemType!] type. Leave the rest of the pinnedItems
selection unchanged.

Comment thread src/lib/github.ts
Comment on lines +165 to +174
pinnedItems: {
nodes: {
name: string;
description: string | null;
stargazerCount: number;
forkCount: number;
primaryLanguage: { name: string; color: string } | null;
url: string;
}[];
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Bump the Redis cache key to avoid crashes from schema mismatch.

You added pinnedItems as a required field to GitHubContributor. However, user profiles that are already cached in Redis will not have this field. When these cached profiles are loaded, pinnedItems will be undefined, violating this TypeScript contract. If downstream UI code attempts to access contributor.pinnedItems.nodes without optional chaining (as the strict type suggests), it will crash the profile page.

To prevent runtime errors and ensure the new feature is immediately visible to all users, bump the cache key version in fetchContributorProfile.

🛠️ Proposed fix outside the selected lines

Apply this change around line 217 to invalidate the cache:

 export async function fetchContributorProfile(
   login: string,
   token: string
 ): Promise<GitHubContributor> {
-  const cacheKey = `github:profile:${login.toLowerCase()}`;
+  const cacheKey = `github:profile:v2:${login.toLowerCase()}`;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/github.ts` around lines 165 - 174, Update fetchContributorProfile to
bump the Redis cache key version, invalidating profiles cached before the
required pinnedItems field was added. Keep pinnedItems required and ensure all
newly fetched profiles use the new cache key so downstream access to
pinnedItems.nodes remains safe.

@PRODHOSH
PRODHOSH self-requested a review July 17, 2026 16:26
@PRODHOSH PRODHOSH added ELUSOC ELUSOC project submission completed NEWBIE Beginner — 10 pts beginner Good for newcomers labels Jul 17, 2026
@PRODHOSH
PRODHOSH merged commit 92016ae into PRODHOSH:main Jul 17, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Your PR just got merged, @mspandey — thank you for contributing to OSSfolio!

Your work is now part of the project. Here's what to do next:

  • ⭐ If you haven't already, consider giving the repo a star — it helps us grow.
  • 📢 Share your contribution on LinkedIn, Twitter, or wherever you hang out. You shipped open source!
  • 🔍 Browse other open issues if you want to keep contributing.

We really appreciate you taking the time. See you in the next PR! 🚀

@PRODHOSH

Copy link
Copy Markdown
Owner

@all-contributors add @mspandey for code

im adding u to the contributors list in readme
join discord from #34 and star the repo
also pls use the exact pr template from here on
read the #19 and CONTRIBUTING.md for clear info
thanks @mspandey

@allcontributors

Copy link
Copy Markdown
Contributor

@PRODHOSH

I've put up a pull request to add @mspandey! 🎉

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

Labels

backend API / Database / Server beginner Good for newcomers completed ELUSOC ELUSOC project submission NEWBIE Beginner — 10 pts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add a Pinned Repositories section to profile pages

3 participants