GitHub REST API for getting repo's all open pull requests COUNT without downloading them - rest

I'm trying to find a GitHub APIs for open pull requests count, without downloading them. ()
I looked through GitHub search API and repos API
https://developer.github.com/v3/search/#search-issues-and-pull-requests
https://api.github.com/repos/pulls?state=open
But wasn't able to find here.
example of big repository

To search for PRs, you can use issues search with is:pr modifier:
https://api.github.com/search/issues?q=rockstars%20state:open%20is:pr
The total_count field of the response is what you need.

Related

Can a workflow badge be retrieved with the GitHub API?

The GitHub API documentation shows an example for retrieving repository workflows.
The response includes a badge_url field for each workflow. For example:
"badge_url": "https://github.com/octo-org/octo-repo/workflows/CI/badge.svg"
Is it possible to retrieve the badge using the GitHub API? My question arises for a scenario where I'm trying to retrieve the badge for a private repository, and it would be more convenient to use the GitHub API versus alternative approaches.

Azure Devops - How to get published information of a wiki page using Rest API

I referred this Microsoft document "MS Rest API documentation for wiki" and was able to get all the pages available in wiki. I was trying to get the published author and published time related information for which there is no available reference.
Is there any Azure DevOps Rest API available to get this information?
Azure Devops - How to get published information of a wiki page using Rest API
I am afraid there is no such REST API at this moment, however you can track it by tools such as Fiddler or press F12 in Chrome browser then select Network.
On the web UI, we could access the View revisions of the Wiki:
We could get the history of this Wiki:
Then we press F12 and click the first history, we could get the REST API like below:
https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/<CommitsId>?
But, if we want to automate it by REST API, This seems impossible at the moment.
To automate it, we need to get the first commit ID for the Wiki, I could use the REST API:
https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/?
Now, I could get the all the commits, but those commits for all Wiki files, and there are no other parameters that can be used to filter out which wiki document the commit is associated with. So, we could not get the first commit for each wiki automatically. That is the current limitation.
Hope this helps.
You can get commits from specific pages: searchCriteria.itemPath=
Here is doc:
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-6.0
Wiki page path will be: /WikiName/Folder--Name/Page-Name.md
Keep in mind that space in page name or folder name you need to replace with '-'. Also add extension to the page '.md'

How to get pull requests references for an issue

Given a GitHub issue, is there any way to get the pull requests that reference to that issue via API?
That info is showed in the GitHub html page but I can't see nothing in the API documentation.
Is it really possible?
is there any way to get the pull requests that reference to that issue via API
Not directly.
Even the reverse is not possible, as a pull request has a link 'issue' pointing to... itself.
But as mentioned in the issue API:
In the past, pull requests and issues were more closely aligned than they are now.
As far as the API is concerned, every pull request is an issue, but not every issue is a pull request.
This endpoint may also return pull requests in the response. If an issue is a pull request, the object will include a pull_request key.
So you would need to list the comments of a pull request (using the Issue Comments API since comments on PR are done with it), and parse said comment to find a reference to an issue.

Get Pipeline Value of GitHub Issues?

I use ZenHub to manage my Issues on GitHub.
When I go to the detail of an issue I can see the property "pipeline" in GitHub which is exactly the column where the Issue is saved.
Now I want to get the pipeline information out of my issues using the API of GitHub. But none of the Issue-Methods
GET /repos/:owner/:repo/issues or GET /repos/:owner/:repo/issues/:number seem to have any information about the pipeline. Is it hidden anywhere else?
Pipeline is purely a ZenHub feature.
As such, it is not exposed in the Github API Issues (or in any other GitHub API)
A ZenHub public API is in the making (issue 172).
Update: The API is available: ZenHub API
With the Github API v4, you can query the combinedContexts of a commit to retrieve a list of status contexts and check runs for the commit triggering your pipelines.

GitHub API - get details of multiple repositories

I am putting together a page that lists the plugins for the Knockout library.
Right now I am using a simple list of repositories, e.g.
[
"civicsource/knockout-responsive"
"civicsource/knockout-spin"
"civicsource/knockout-transitions"
"CraigCav/Knockout-jqGridBinding"
"CraigCav/ko.datasource"
]
Then getting the details for each of those repositories with the GitHub API with e.g.
$.getJSON("https://api.github.com/repos/" + identity)
These results are cached for a few hours in localStorage, so the client isn't re-requesting them every few minutes.
This is okay for the moment because the GitHub API has a rate-limit of 60 per hour and there are currently 58 plugins in the list.
However, when we breach 60 plugins, we will not be able to load within an hour the details of all the items on the list.
Two solutions come to mind, namely having some server-side caching, or alternatively asking GitHub if they'll up the limit for this page to whatever the number of plugins is.
A better solution would be to reduce the number of requests, in particular request the details of all these plugins in one GitHub API call. I was unable to find a suitable on in the GitHub API documentation.
Is there a hook in the GitHub API to get the details of multiple repositories in a single call?
Is there a hook in the GitHub API to get the details of multiple repositories in a single call?
No, that's not possible currently with the GitHub API. You can only fetch a list of repositories from a specific user (or org) or a list of all public repositories. You can't say "give me the information for repositories X, Y and Z" in a single request.