Can the GitHub GraphQL API create files in a repository? - github

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.

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.

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

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.

GitHub REST API: Commits per release

I'm trying to obtain the commits that were included on an specific release, on a repository that uses tags to identify releases. According to this answer, this doable through git log.
However, I need to gather this information for several repositories, so using an API is more convenient. Is it possible to get that information from GitHub's REST API?
You can use the compare two commits API:
GET /repos/:owner/:repo/compare/:base...:head
This is the same as locally running git log base..head.
Given that you want to automate this for several repos check List your Repositories API as well
Let me know if you need more info.

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