rest.js icon indicating copy to clipboard operation
rest.js copied to clipboard

Can we have search option in octokit.repos.listForAuthenticatedUser()

Open rohitcoder opened this issue 3 years ago • 1 comments

What’s missing? I don't see a Search option in octokit.repos.listForAuthenticatedUser(), and i think this is same for the underlying REST API by Github, Can someone recommend me any good alternative to search all repositories from my organization and personal profile?

I was thinking to load all repos, index them in local DB and then run a search on that, but this kind of feature is already available in bitbucket and gitlab, we don't need to index repos for them.

I'm using below code for listing all repos

const repos = await octokit.repos.listForAuthenticatedUser({
  visibility: 'all',
  affiliation: 'owner,collaborator,organization_member',
  per_page: args.limit,
  page: args.page,
  sort: 'updated',
})

In bitbucket and Giltab we've q and query within listing Repositories. Can we've something like that?

Why? Let's suppose I've 3,000 Repos and I want to search for any specific one, how I'll do that? (affiliation could be owner,collaborator,organization_member)

Alternatives you tried I've the last option to index them in DB and then search on top of it, but there will be another issue, an organization can delete some repo, and create new repos, and adding/removeing these many repos in DB every time will not be a good approach.

rohitcoder avatar Aug 11 '22 09:08 rohitcoder

Hi @rohitcoder! 👋🏻 Depending on your search criteria, the "Search repositories" API (https://docs.github.com/en/rest/search#search-repositories) might work for you. Can you give that a go?

timrogers avatar Aug 11 '22 10:08 timrogers