Is there a way to retrieve Github repositories whose language has been changed? - github

I am trying to get all repositories whose language was Java but had changed to Kotlin and vice versa.
Does anyone know if it's possible to filter these repositories with the Github api?

If you are looking to compare before/after, in terms of a programming languages for particular GitHub repos, I'm not sure you can do that short of having a big-data project.
If you want to filter GitHub repos by programming language, the GitHub API documentation states:
Suppose you want to search for popular Tetris repositories written in Assembly. Your query might look like this.
curl https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
Also,
Checkout my open-soure project Git-Captain, which may help you.
It's an open-source web-application built with Node.js utilizing GitHub API to find, create, and delete a branch throughout numerous GitHub repositories.
Can be setup for organizations or a single user.
I have a step-by-step how to set it up on a server to communicate with the GitHub API.

Related

Is there any automated way of populating a Moodle training from a GitHub repository?

Moodle is a platform for creating training and educational material. By default, it is possible to make the content by clicking on controls.
GitHub is a place for version management and teamwork.
Question: I wondered if there is a way to (programmatically) populate/update a Moodle training from a GitHub repository. Does Moodle offer an API that would allow the implementation of such a functionality?
Idea:
The GitHub repository contains mark-down files in a specific format and folder structure.
Yes. Theoretically. Moodle offers an API (https://docs.moodle.org/dev/Web_service_API_functions) through which you can update courses along with much other functionality.
You would have to write the script yourself, of course. I've been briefly looking in to this as well, but the moodle webservice API is not intuitive and is underdocumented. There's been talk of making a more sensible, RESTful API (https://tracker.moodle.org/browse/MDL-49607) but it doesn't seem to have gotten anywhere.

How to set repository's social media preview via Github API?

I am working on a project where I want to set the social media preview for multiple (lots of repositories) I own. I know there is a manual way to do it as mentioned here.
I was wondering if there was some way to do it via Github API or what kind of scripting could automate the task for adding social previews to multiple repositories.
If it was doable via the API, it'd almost certainly be one of the parameters at https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#update-a-repository. It's not there as of the time of this writing, but maybe someday.
There's sort of a feature request at https://github.com/orgs/community/discussions/32166. It's unclear if there's a better place to make an API feature request.

Can the GitHub GraphQL API create files in a repository?

The v3 API allowed for the creation of files but I can't seem to find a way to do this with the v4 GraphQL API. Is it currently possible?
Here is a discussion about creating a repository with v4 and as the guy from github staff said:
"(they) don’t currently provide a rough estimate of when specific
features will ship."
and I guess it's the same with file creation.

GitHub to share a set of SPARQL queries

I am using github to share a set of SPARQL queries:
http://www.boisvert.me.uk/opendata/sparql_aq+.html?file=specific%20sensor.txt
Currently the simple work allows end-users to access queries stored on the github repository, but ultimately I want to allow them to also modify the queries, as with a pastebin, and make use of the repository to better manage the shared system. Ideally I would want end-users who may not be very tech-savvy, to be able to make minor changes to queries to an open, linked data endpoint: so to keep the technology barrier low.
My problem is this: how best to structure the github project and exploit the API to make the most of the available information? I can think of different points:
Currently the project (https://github.com/boisvert/unshaql) holds client code and example queries. Does it make a difference to create an independent project (separate from the web client code) for SPARQL queries?
I would use directories within the project to classify/tag queries, and file names to title them. Are there better alternatives? It strikes me that a hierarchical structure is not a good fit to tags.
When end-users save, a simpler (and cruder) option is to allow them to push their file into just one branch, which holds the examples. A better engineered one would be to allow them to use their github credentials to fork the set of SPARQL queries and edit theirs, but with unaware users, how do I avoid creating a mess?
I think that a rigular Github repository is a rather bad fit for this kind of content. If your users have a GitHub account, you should probably use Gists instead: https://help.github.com/articles/about-gists/ I never used this myself, but it seems perfectly adapted to what you are planning. Your site could become a DB of tags over user-provided gists. That would however lock you into GitHub-specific solutions.
Even if you go for a regular repository, you should not allow the users to commit into the repository hosting your code: that would be a serious security hazard as you won't be able to control the parts of the repository to which they are allowed to commit.
If you setup two repositories, it's rather easy to have the code of a webpage in a repository, and the code automatically commited in another repository (under an anonymous identity so that your users don't have to create a github account).
Also, note that the oauth token should never be stored in a public repository (or the GitHub robots will invalidate it in a matter of hours).
See Hiding GitHub token in .gitconfig for a solution to this sub-problem.

Getting Jira Issue's Branches from REST API

I am working with the Atlassian product Jira's REST API, combined with Stash. I have the two applications linked so that I can create branches in Stash for the Jira tickets. That is all working great, but what I need is a REST API call or really any call to get the branches for the issue to help automate our development process.
/rest/api/2/{issueid} // Doesn't work
The standard issue pull, Atlassian documentation https://docs.atlassian.com/jira/REST/6.0.1/#id147461, doesn't give me any information about the branches created for the issue.
The only other way I can think of to get the information is to scan every project's repo for the specific name of the ticket, which sounds wildly inefficient.
I'm using:
Jira version 6.2.6
Stash version 3.0.1
Found the rest url I was looking for and so far I have found zero documentation on it. Anyway I am going to use it as this is the actual url that Jira uses in the user interface.
{Jira App Url}/rest/dev-status/latest/issue/detail?issueId={IssueKey}&applicationType=stash&dataType=pullrequest
The docs: https://quickstart.atlassian.com/download/stash/jira-integration mention there is information about "all branches related to the issue". The decision which branch is related to which issue comes from branch name. I assume what you would like to get is "all branches that have commits related to particular issue" (issue key must be in commit message). As far as I know this is not supported at the moment.
One solution that comes to my mind is using Stash git hooks (https://blogs.atlassian.com/2013/03/stash-22-customize-workflow-git-hooks-api-merge-checks/) with custom JIRA plugin that exposes custom REST API to collect information triggered by git hook.
I'd look at the source for the JIRA part of the integration to see what REST calls it makes to stash. They're probably ones documented here: https://developer.atlassian.com/static/rest/stash/3.0.4/stash-branch-utils-rest.html
but they may also use the core REST API for Stash
Try This :
{Jira App Url}/rest/dev-status/latest/issue/detail?issueId={IssueKey}&applicationType=stash&dataType=repository