Skip to content

Commit

Permalink
Add example to create repository with an initial commit with empty RE…
Browse files Browse the repository at this point in the history
…ADME.md (#2333)

Related: #2330
  • Loading branch information
yuseferi committed Apr 11, 2022
1 parent c63c9a9 commit edc25cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/newrepo/main.go
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down

0 comments on commit edc25cb

Please sign in to comment.