简体   繁体   中英

Github get labels of PULL request from api

I use the Github API to get my open pull requests. Now I also want to add the labels attached to my view. How can I get them?

Thats the URL I use got GET the data so far:

url = ' https://api.github.com/repos/ ' + name_repository + '/pulls?access_token=' + TOKEN;

To fetch the labels for a pull request, you need to fetch the associated issue (pull requests are basically issues with code attached). So, if you have pull request 324 in repository foo/bar , then fetch this issue to get the labels for that pull request:

https://api.github.com/repos/foo/bar/issues/324

See https://developer.github.com/v3/pulls/#labels-assignees-and-milestones

The same thing is true if you want to fetch a list of pull request -- you need to fetch the list of issues and use the labels from that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM