mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
check if repo is empty, create readme if it is (#45)
This commit is contained in:
@@ -80,6 +80,17 @@ public class GithubService : IManageGithub
|
||||
try
|
||||
{
|
||||
var ghRepo = await _ghClient.Repository.Get(org, repo);
|
||||
if (ghRepo.Size == 0)
|
||||
{
|
||||
// Create a new file and commit it to the repository
|
||||
var createChangeSet = await _ghClient.Repository.Content.CreateFile(
|
||||
org,
|
||||
repo,
|
||||
"README.md",
|
||||
new CreateFileRequest("Initial commit", "# Readme")
|
||||
);
|
||||
}
|
||||
|
||||
await _ghClient.Git.Reference.CreateBranch(org, repo, branch, ghRepo.DefaultBranch);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user