Here is an github api link to receive commits for a specific word search key:
https://api.github.com/search/commits?q=%22sentiment%22&per_page=100&page=1
However if I test the second,third etc. page I receive different number of total_count
Why is this happening?
Related
On GitHub, I would like to be able to have a list of Pull Requests that require my attention. This must include any pull request that is created by a member of my team that was not authored by me, but requires a review from me. So far, I have this:
is:pr is:open user:<ORGANIZATION> involves:coworker involves:coworker -author:#me -reviewed-by:#me
The problem is, when my review is dismissed or becomes stale, -reviewed-by:#me filters out that pull request because I've previously reviewed it, even though that review has been dismissed. If I've already approved it or if the pull request has changes requested by me that are not outdated, I do not want to see them in the list.
Is there an online query to be able to list these pull requests from github.com/pulls?
Taking inspiration of this use-case which illustrate the power of GitHub CLI gh, you could, for each of the currently listed PR, do a check (using the "List reviews for a pull request" API):
gh api repos/<your repo name>/pulls/<PR ID>/reviews --jq '.[] | [.id,.state] | join("=")' | grep -Po '\d+(?=\=DISMISSED)'
You can add the .user.login attribute to filter on your name and check if you have, for a given PR, reviews in "DISMISSED" state.
If yes, you know you can filter you that PR from your intial query.
This is not straightforward, as some processing is needed, but it can help.
I am currently doing my thesis and analyzing the behavior for code reviews. For this I want to know the size of the pull request that is reviewed. The rest of the information for example authors, reviewers, times etc. I got already by calling the rest API. However I cannot seem to find a way to get the amount of lines changed in each file, or a total number (which is also sufficient).
I have browsed the documentation and found some ways to get amount of files changed, see https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get%20commits?view=azure-devops-rest-5.1. However, I didn't found a way to get the amount of changed lines per file or a total amount.
So is there a way to get amount of lines changed in a Pull Request or between two commits?
For your issue , I am afraid that there is currently no official released REST API to do that. A similar question has been answered in this case ,please refer to it for details, you can refer to these steps to achieve your requirements:
1.Get a list of commits to get a commit’s commit id.
2.Get a commit by commit id (steps 1) to get parents value and repository id (The value at the end of _links>Repository>href) (Using the URL of _links>Changes>href can get file path if you don’t know)
3.Get file diff by this POST request https://dev.azure.com/{organization}/{project}/ _api/_versioncontrol/fileDiff?__v=5&diffParameters=[data 1]&repositoryId=[repository id]
You could also add your request for this feature on our UserVoice site, which is our main forum for product suggestions,our PM and product team will kindly review your suggestion.
I want to get all public Github repositories (api.github.com/repositories) with pagination (for example, get it by 10 repos). I tried https://api.github.com/repositories?page=2&per_page=10, but it's works only on search, but doesn't work on all public repos. How To get all public repos with pagination?
This is explained in the Github API documentation, see https://developer.github.com/v3/repos/#list-all-public-repositories.
The pagination is done by using the since URL parameter instead of page, the value of since is the numerical id of the last repository that you already have seen.
If you omit the since parameter the response will return a list of repositories, the first repo has id 1. To get the next page you add ?since=369 to the next request (369 is the last id that I get when requesting the first page).
For convenience the responses also includes the Link header which contains a ready-made URL to the next page.
I am trying to get all organization items through http://host/api/v3/organizations?page=2&per_page=100
The default size seems like 30, and 100 seems like the max limit per request.
But above link still only returns the first 100 items, i.e, not 101-200th
I also tried http:host//api/v3/organizations?page=2
No matter which page I set, it only returns the first 30 items.
How can I get the entire list of organization items please? Please help. Appreciate.
From Github API reference for listing organizations :
Note: Pagination is powered exclusively by the since parameter. Use
the Link header to get the URL for the next page of organizations.
For instance checking the 2nd page using curl :
curl -I "https://api.github.com/organizations"
gives the following link header :
Link: <https://api.github.com/organizations?since=3043>; rel="next", <https://api.github.com/organizations{?since}>; rel="first"
So the next page will be https://api.github.com/organizations?since=3043
For each request you would check this header to get the next url to hit
when using github users api to return users data through
https://api.github.com/users?page=6&per_page=2
return the same data every one although change page parameter value and per_page
why this and how to fix to change different data
i try to edit header request and add this header
Name Link
Value <https://api.github.com/users?page=1&per_page=2>; rel="next",<https://api.github.com/users?page=50&per_page=2>; rel="last"
But Still not working
After my search
now Github use API V3 and if you want return users with paging you can use this
https://api.github.com/users?since=1&per_page=100
Instead of using "page" and "per_page", that endpoint uses "since" and "per_page".
The since parameter says from which user ID the API should start listing users. For example:
https://api.github.com/users?since=1&per_page=100
will start listing users from the user with ID 1, and
https://api.github.com/users?since=10001&per_page=100
will start listing users from the user with ID 10001.