使用 GitHub API 在一次提交中编辑多个文件
Edit multiple files in single commit with GitHub API
我在 C# webapp(使用 Blazor)中使用 GitHub API。我希望能够创建一个提交来添加、删除和编辑存储库中一个文件夹中的多个文件。我知道我可以使用这些内容向 URL https://api.github.com/repos/[username]/[repository]/contents/[file]
发送 PUT 请求来创建文件(我还可以通过添加 SHA 哈希来编辑文件):
{
"message": "[Commit message]",
"content": "[Content encoded in base64]",
"committer": {
"name": "[Committer name]",
"email": "[Committer email]"
}
}
但这会为每个文件更改创建一次提交。有什么方法可以在一次提交中执行多个操作(使用 GitHub API 或其他方式)?我会使用 libgit2sharp 之类的东西,但我不想将存储库克隆到文件系统上的文件夹中。
Is there any way that I can do multiple operations in a single commit (either using the GitHub API or something else)?
有底层 Git Data API 可用于从头开始构建提交:
我在 C# webapp(使用 Blazor)中使用 GitHub API。我希望能够创建一个提交来添加、删除和编辑存储库中一个文件夹中的多个文件。我知道我可以使用这些内容向 URL https://api.github.com/repos/[username]/[repository]/contents/[file]
发送 PUT 请求来创建文件(我还可以通过添加 SHA 哈希来编辑文件):
{
"message": "[Commit message]",
"content": "[Content encoded in base64]",
"committer": {
"name": "[Committer name]",
"email": "[Committer email]"
}
}
但这会为每个文件更改创建一次提交。有什么方法可以在一次提交中执行多个操作(使用 GitHub API 或其他方式)?我会使用 libgit2sharp 之类的东西,但我不想将存储库克隆到文件系统上的文件夹中。
Is there any way that I can do multiple operations in a single commit (either using the GitHub API or something else)?
有底层 Git Data API 可用于从头开始构建提交: