我正在尝试查找具有特定失败检查的 PR。
有没有办法获取拉取请求检查的信息?
这是一个屏幕截图:
我没有从 PR 对象中看到任何明显的东西:
g = Github("user", "password")
user = g.get_user()
org = g.get_organization('my_org')
repo = org.get_repo('myrepo')
for pr in repo.get_pulls():
print(pr)
for el in dir(pr):
print(el)
sys.exit()
按照我的理解,API 状态属于提交,而不是 PR 本身。 尝试获取 PR 中的最后一次提交,然后使用http://pygithub.readthedocs.io/en/latest/github_objects/Commit.html#github.Commit.Commit.get_statuses。
凉爽的。 接得好。 随意关闭这个坏男孩!
感谢您查看这个!
一件小事:看起来您现在可以 POST 来创建/更新状态:
https://developer.github.com/v3/repos/statuses/#create-a-status
如果 PyGithub 支持这个就好了:)
@grayaii这已经在那里了。 您可以使用Commit.create_status
方法为您的 PR 创建状态检查。 然而,诀窍是您需要找到正确的提交来创建状态。
这是我在我的一个项目中所做的:
sha = pr.head.sha
repo.get_commit(sha=sha).create_status()
最有用的评论
按照我的理解,API 状态属于提交,而不是 PR 本身。 尝试获取 PR 中的最后一次提交,然后使用http://pygithub.readthedocs.io/en/latest/github_objects/Commit.html#github.Commit.Commit.get_statuses。