如何在 Bitbucket 拉取请求上创建评论

How to create a comment on a Bitbucket pull request

您如何以编程方式对托管在 Bitbucket 上的拉取请求发表评论(最好使用 Python)?

我有一个 Buildbot 服务器连续 运行 测试我在 Bitbucket 上托管的所有分支,在它为一个分支运行测试后,我希望它检查任何未决的拉取请求并自动创建注释注释测试状态(例如 pass/fail)。

This and this 表明 Bitbucket 有相当丰富的 API,甚至有列出评论的方法,但我找不到任何在拉取请求上创建评论的方法。

根据1.0 API documentation

POST a new comment Creates a new comment on an request using the specified content data. The caller must be authenticated and have access to the repository to create an request. POST https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug}/pullrequests/{pull_request_id}/comments --data "content=string"

--data 的示例在上面的位置可用。

另外,根据 API 2.0只支持读取pull request评论,API需要使用1.0来操作它们