Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;

like image 888
lony Avatar asked Mar 12 '23 06:03

lony


1 Answers

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.

like image 72
Ivan Zuzak Avatar answered Mar 19 '23 02:03

Ivan Zuzak