How to create commit using diff or patch using GitHub API?

If the file .patch(or any other diff, however it is saved), can you apply it to the repository on this branch using only the GitHub API ?

I saw the Update fileendpoint API . But it only supports updating one file at a time, creating as many commits as there are files, so it’s not the best solution.

I also saw the Create commitendpoint , but I really don't understand how I create the contents of the commit. I am wondering if I should not download the patch as the first blob , but I'm not sure how this works ...

Why?

The reason for not using git is because I want to avoid cloning the repository or even have a repository on disk.

I am creating a SaaS application, and if there is a way to avoid storing third-party code on disk, even for a minute, I would like it to be much safer.

The difference will be generated by downloading the archived version of the repository and running the tool in the directory. At this point I will have to download the code, but at least I am not loading the whole story. The directory will be deleted immediately after the file is created .patch.

If I have another way, I also open it.

+4
source share

Source: https://habr.com/ru/post/1676308/


All Articles