Skip to content

Improve GithubRepositoryProvider.getUserRepos – EXP-407 #18468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 10, 2023

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Aug 9, 2023

The graphql query is extend to mimic what you would see in Top Repositories box visiting github.com.

Description

Summary generated by Copilot

πŸ€– Generated by Copilot at ca89a5a

Rewrite getUserRepos method in github-repository-provider.ts to use a more complex GraphQL query that fetchs and categorizes the user's repositories. This improves performance, accuracy, and supports a new UI feature.

Related Issue(s)

Fixes EXP-407

How to test

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

The graphql query is extend to mimic what you would see in Top Repositories box visiting github.com.
@AlexTugarev
Copy link
Member Author

@akosyakov, please check with the preview env to see if that works as expected for you.
FYI, I've noticed that GitHub does the Top Repositories in two phases: 1) top ones and 2) my (viewers) repositories.

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Aug 9, 2023

The query in plain code:

fragment Repos on RepositoryConnection {
	nodes {
	  url
	}
  }
  
  query topRepositories {
	viewer {
	  contributedTo: repositoriesContributedTo(
		first: 100
		orderBy: {field: PUSHED_AT, direction: DESC}
		includeUserRepositories: true
		contributionTypes: [COMMIT]
	  ) {
		...Repos
	  }
	  original: repositories(
		first: 100
		ownerAffiliations: OWNER
		isFork: false
		isLocked: false
		orderBy: {field: UPDATED_AT, direction: DESC}
	  ) {
		...Repos
	  }
	  forked: repositories(
		first: 100
		ownerAffiliations: OWNER
		isFork: true
		isLocked: false
		orderBy: {field: UPDATED_AT, direction: DESC}
	  ) {
		...Repos
	  }
	}
  }

@AlexTugarev
Copy link
Member Author

AlexTugarev commented Aug 9, 2023

Strange, it looks like it's not even called πŸ™ˆ
cc. @akosyakov

Fixed that bug.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

it looks better now, i can find my repos as well as repos from gitpod-io org

@AlexTugarev
Copy link
Member Author

/unhold

@roboquat roboquat merged commit e971a66 into main Aug 10, 2023
@roboquat roboquat deleted the at/gh-getuserrepos branch August 10, 2023 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants