简体   繁体   English

Github 应用程序如何列出用户的私有存储库?

[英]How can a Github App list a user's private repositories?

I am trying to list a user's private github repositories via a github app.我正在尝试通过 github 应用列出用户的私有 github 存储库。

(Note: I am not currently using OAuth, and I am looking for a user's repositories, not an org's.) (注意:我目前没有使用 OAuth,我正在寻找用户的存储库,而不是组织的。)

I am attempting to make this API call with an installation client, that is, using a client specific to an installation of an app and using a JWT with my private key.我正在尝试使用安装客户端进行此 API 调用,即使用特定于应用程序安装的客户端并使用带有我的私钥的 JWT。

This is the endpoint I am requesting:这是我请求的端点:

https://api.github.com/user/repos?per_page=100&visibility=private

This yields the following response:这会产生以下响应:

{
  "message":"Resource not accessible by integration",
  "documentation_url":"https://docs.github.com/rest/reference/repos#list-repositories-for-the-authenticated-user"
}

The /user/repos not listed in the list of valid app endpoints so I'm not surprised this doesn't work. /user/repos未在有效应用程序端点列表中列出,因此我并不感到惊讶这不起作用。

Once a user installs my app, how can I list their private repos?一旦用户安装了我的应用程序,我该如何列出他们的私有存储库?

The way to do this is by calling the /installation/repositories endpoint.执行此操作的方法是调用/installation/repositories端点。 An "installation" might have access to many repos across many users, and this endpoint will encompass them all.一个“安装”可能可以访问许多用户的许多回购协议,而这个端点将包含所有这些用户。

This endpoint is documented here: https://docs.github.com/en/rest/reference/apps#list-repositories-accessible-to-the-app-installation此端点记录在此处: https://docs.github.com/en/rest/reference/apps#list-repositories-accessible-to-the-app-installation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM