From edc25cb010764bef136b68f571054c4a82294cd9 Mon Sep 17 00:00:00 2001 From: Yusef Mohamadi Date: Tue, 12 Apr 2022 01:54:40 +0200 Subject: [PATCH] Add example to create repository with an initial commit with empty README.md (#2333) Related: #2330 --- example/newrepo/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/newrepo/main.go b/example/newrepo/main.go index a6d7c10489..ed3442473a 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -24,6 +24,7 @@ var ( name = flag.String("name", "", "Name of repo to create in authenticated user's GitHub account.") description = flag.String("description", "", "Description of created repo.") private = flag.Bool("private", false, "Will created repo be private.") + autoInit = flag.Bool("auto-init", false, "Pass true to create an initial commit with empty README.") ) func main() { @@ -40,7 +41,7 @@ func main() { tc := oauth2.NewClient(ctx, ts) client := github.NewClient(tc) - r := &github.Repository{Name: name, Private: private, Description: description} + r := &github.Repository{Name: name, Private: private, Description: description, AutoInit: autoInit} repo, _, err := client.Repositories.Create(ctx, "", r) if err != nil { log.Fatal(err)