Skip to content

fix(github): prioritize user repos in clone search#313840

Draft
PaulCutcliffe wants to merge 4 commits intomicrosoft:mainfrom
PaulCutcliffe:fix/github-clone-rank-org-repos
Draft

fix(github): prioritize user repos in clone search#313840
PaulCutcliffe wants to merge 4 commits intomicrosoft:mainfrom
PaulCutcliffe:fix/github-clone-rank-org-repos

Conversation

@PaulCutcliffe
Copy link
Copy Markdown

Fixes #141754

Copilot AI review requested due to automatic review settings May 2, 2026 02:14
Copy link
Copy Markdown
Contributor

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

Updates the GitHub remote source provider used by the “Clone From GitHub” flow to rank repositories more relevant to the authenticated user (including org membership) ahead of general GitHub search results.

Changes:

  • Reorders aggregation so authenticated-user repos are returned before global search results.
  • Expands authenticated-user repo listing to include organization_member affiliation.
  • Adds local query matching to filter cached user repos when typing a query.

Comment on lines 75 to 78
const user = await octokit.users.getAuthenticated({});
const username = user.data.login;
const res = await octokit.repos.listForAuthenticatedUser({ username, sort: 'updated', per_page: 100 });
const res = await octokit.repos.listForAuthenticatedUser({ username, affiliation: 'owner,collaborator,organization_member', sort: 'updated', per_page: 100 });
this.userReposCache = res.data.map(asRemoteSource);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch.

Comment on lines +32 to +35
function matchesQuery(remoteSource: RemoteSource, query: string): boolean {
const normalizedName = remoteSource.name.toLowerCase();
return query.toLowerCase().trim().split(/\s+/).every(part => normalizedName.includes(part));
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch.

@PaulCutcliffe
Copy link
Copy Markdown
Author

@copilot apply changes as per your suggestions this thread

@PaulCutcliffe
Copy link
Copy Markdown
Author

@copilot apply changes based on the comments in this thread

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clone from Github doesn't rank org repos highly

4 participants