Can a workflow badge be retrieved with the GitHub API? - github

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.

Related

Is it possible to fetch the issue/PR templates of a Github repository, via REST API?

I wanted to pre-fill some Github issue/PR creation forms, by fetching the templates from the repository via REST API.
Is this possible? I've searched in the documentation, but I couldn't find an API for this purpose.

When should you not use GitHub GraphQL API?

Much has been written about the benefits of the GitHub GraphQL API. And this is a really great technology. The only thing I can't figure out is in what situations is it still better to use the good old REST API v3?
Github GraphQL API is subject to the following caveats:
GraphQL API can only be accessed using authentication. You need a token to use this API. Thus, you can't use GraphQL in an environment where you can't secure the provisioning of this token. For example, in a web app without github authentication. This is a big caveat, especially for people who want to create web app or scripts that target only public repository informations.
Searching commits and code using the search API is not possible in Github Graphql. Only searching repos, issues and users are supported (for the search API)
some features like comparing commits and getting contributors are not possible yet in Graphql. Another example: you can't recursively get a tree using GraphQL API
some mutations already available in v3 may not yet have been implemented in GraphQL (create commit, create tag, create branch etc...), checkout mutations documentation

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'

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

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.

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.