Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create repository with an initial commit with empty README #2333

Merged
merged 3 commits into from Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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