Github API: how to find the branches of a pull request?

前端 未结 1 880
无人及你
无人及你 2020-12-31 04:06

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 th

相关标签:
1条回答
  • 2020-12-31 04:40
    1. Access a Pull Request URL. Let's use https://api.github.com/repos/github/gitignore/pulls/566 as an example.

    2. 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 is github:master, meaning it's the master 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 is fidelski:add-obvious-autotools-files, meaning it's the add-obvious-autotools-files branch for fidelski/gitignore.
    • head.ref is the branch name add-obvious-autotools-files.
    • head.sha is the current SHA of that branch.
    0 讨论(0)
提交回复
热议问题