Github API:如何找到拉请求的分支? [英] Github API: how to find the branches of a pull request?
问题描述
Github API(v3)允许您获取pull请求的列表,并获取有关单个pull请求的更多详细信息。我似乎无法找到的是拉取请求来自的分支的名称,以及拉取请求所建议的代码被合并到的分支。
使用Github API,您如何确定牵扯请求中的分支? / div>
-
访问合并请求网址。让我们使用 https://api.github.com/repos/github/gitignore/pulls/566 为例。
-
解析JSON对象。
合并请求引用两个分支。 base
分支是合并目标。通常这是存储库的 master
分支。
base.label
github:master
,意思是它是master
分支,用于>github / gitignore
。
base.ref
是分行名称master。
base.sha
是该分支的当前 SHA 。
头
分支是你合并到 base
中的内容。
head.label
是fidelski :add-obvious-autotools-files
,意思是fidelski / gitignore的
。add-obvious-autotools-files
分支
head.ref
是分支名称add-obvious-autotools -files
。
head.sha
是当前的 SHA
The Github API (v3) allows you to get a listing of pull requests, and get more details on an individual pull request. What I can't seem to find is the name of the branch the pull request is coming from and the branch the pull request is suggesting the code be merged into.
Using the Github API how do you determine the branches involved in a pull request?
Access a Pull Request URL. Let's use https://api.github.com/repos/github/gitignore/pulls/566 as an example.
Parse the JSON object.
A Pull Request references two branches. The base
branch is the merge target. Usually this is the master
branch of the repository.
base.label
isgithub:master
, meaning it's themaster
branch for >github/gitignore
.base.ref
is the branch name "master".base.sha
is the current SHA of that branch.
The head
branch is what you're merging into the base
.
head.label
isfidelski:add-obvious-autotools-files
, meaning it's theadd-obvious-autotools-files
branch forfidelski/gitignore
.head.ref
is the branch nameadd-obvious-autotools-files
.head.sha
is the current SHA of that branch.
这篇关于Github API:如何找到拉请求的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!