通过API获取私人github存储库的请求 [英] Get pull requests for private github repository via API

查看:246
本文介绍了通过API获取私人github存储库的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式获取特定专用github存储库的打开请求列表 - 我们的结果如下。我假设我只能通过github api(http://developer.github.com/)来做到这一点 - 随时告诉我有另一种方式 - 但我无法弄清楚API也允许这个。给定的API调用似乎假定目标存储库是公共的,而我们的则不是。我原以为会有一种方法可以通过ssh密钥作为给定存储库的用户进行身份验证(与提交作品的方式相同),但我没有看到任何效果。总而言之,我很困惑,一点也不确定,我实际上可以做到这一点。我是否遗漏了文档的重要部分,或者是否可能有一些替代方案可以利用?

解决方案

是的, GitHub Pull Requests API 也支持私有回购。
$ b

使用curl和基本身份验证的示例:


$您需要进行身份验证,否则您会收到一条错误消息,指出存储库不存在。 b $ b

  curl -u用户名https://api.github.com/repos/:user/:repo/pulls 



然后这将提示您输入密码并返回API文档中所述的请求列表。



同时查看身份验证文档: http://developer.github.com/ v3 /#认证


I want to programmatically get a list of open pull requests for a specific private github repository - ours, as it turns out. I assume I can only do this via the github api (http://developer.github.com/) - feel free to tell me there's another way - but I can't figure out whether the API allows this, either. The given API calls seem to assume the target repository is public, which ours is not. I would have thought there would be a way to authenticate as a user of the given repository via ssh key (the same way committing works), but I don't see anything to that effect. All in all I'm puzzled and not at all sure I can actually do this. Am I missing a crucial part of the documentation, or is there possibly some alternative I can leverage?

解决方案

Yes, the GitHub Pull Requests API supports private repos also. You just need to authenticate or you will get an error saying that the repository does not exist.

Example using curl and basic authentication:

curl -u "username" https://api.github.com/repos/:user/:repo/pulls

This will then prompt you for your password and return a list of pull requests as described in the API docs.

Also check out the docs on authentication: http://developer.github.com/v3/#authentication

这篇关于通过API获取私人github存储库的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆