I'm using the GitHub API in a C# webapp (with Blazor). I want to be able to create a single commit to add, delete, and edit multiple files in a folder in a repository. I know I can send a PUT request to the URL https://api.github.com/repos/[username]/[repository]/contents/[file]
with these contents to create a file (and I can also edit a file by adding an SHA hash):
{
"message": "[Commit message]",
"content": "[Content encoded in base64]",
"committer": {
"name": "[Committer name]",
"email": "[Committer email]"
}
}
But this creates one commit for every file change. Is there any way that I can do multiple operations in a single commit (either using the GitHub API or something else)? I would use something like libgit2sharp but I don't want to be cloning the repository to a folder on the filesystem.
Is there any way that I can do multiple operations in a single commit (either using the GitHub API or something else)?
There is the underlying Git Data API that can be used to build up a commit from scratch: