我正在使用/user/repos?type=member&per_page=100&access_token=MYTOKEN
并返回我所属的所有回购。
但是,当我转到disabled
时,部分回购信息为github.com/owner_name/repo/branches
,它表示回购信息被禁用。
但API响应没有给出任何迹象。有什么方法可以说出来吗?
答案 0 :(得分:1)
我问Github support
并得到以下回复:
The API matches the behavior of github.com with regard to disabled repositories. When you sign in and visit https://github.com, you'll see a list of repositories that you have access to under "Your repositories" (on the right-hand side). You should see repo_owner/DISABLED-REPO in that list. If you click on that repository in the list, you should be taken to the page for that repository, but also get a message that the repository has been disabled.
The API provides the same information. If you fetch the list of repositories, the API tells you that you have access to that repository. However, to determine that it has been disabled, you'll need to fetch the repository itself -- there is no special "disabled" attribute when you fetch a list of repositories, which you are doing.
So, try making this request:
https://api.github.com/repos/repo_owner/DISABLED-REPO?access_token=MYTOKEN
You should see a 403 Forbidden status with a helpful message in the body.
Also, I'll pass your question/suggestion to the team to consider including a "disabled" attribute when fetching a list of repositories. However, I can't make any promises about if/when that might happen.