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?
Head Branch: The "Head Branch" is the branch that contains the changes you want to integrate. Title: A short title that describes what this Pull Request is about. Description: An (optional) description text that helps your colleagues learn more about the 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With