如何使用 BitBucket API 获取 PR 的构建状态?

Ash*_*sh 2 bitbucket github-api bitbucket-api jenkins bitbucket-server

将 Bitbucket API 用于任何拉取请求时,未获取 PR 的构建作业详细信息/状态

这是我的 API 网址:

https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID}
Run Code Online (Sandbox Code Playgroud)

构建状态在 GUI 上的样子:

在此处输入图片说明

我还尝试了以下方法来获取 Build 状态但没有运气

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
Run Code Online (Sandbox Code Playgroud)

所以我想知道任何 PR 的构建状态,无论是成功还是失败

提前感谢您的回答。

Yur*_* G. 5

构建状态在提交上,而不是在 PR 上。首先,您应该通过调用找到源分支的最新提交/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}。有关更多详细信息,请参阅文档

获得提交 ID 后,您可以通过调用/rest/build-status/1.0/commits/{commitId}. 有关更多详细信息,请参阅文档