A programming framework for agentic AI
check if repo is empty, create readme if it is (#45)
Kosta Petan2bece0d27e46
diff --git a/samples/gh-flow/src/Microsoft.AI.DevTeam/Services/GithubService.cs b/samples/gh-flow/src/Microsoft.AI.DevTeam/Services/GithubService.csindex 6c50c2938..d04af3b22 100644--- a/samples/gh-flow/src/Microsoft.AI.DevTeam/Services/GithubService.cs+++ b/samples/gh-flow/src/Microsoft.AI.DevTeam/Services/GithubService.cs@@ -80,6 +80,17 @@ public class GithubService : IManageGithubtry{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)