From cdab9067c39269e6ab9ba340422247b6630e70dd Mon Sep 17 00:00:00 2001 From: CEbbinghaus Date: Tue, 15 Oct 2024 16:57:01 +1100 Subject: [PATCH] Added check to Create too --- github/resource_github_branch_default.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/github/resource_github_branch_default.go b/github/resource_github_branch_default.go index 661ae49f42..790aa23c8e 100644 --- a/github/resource_github_branch_default.go +++ b/github/resource_github_branch_default.go @@ -60,8 +60,11 @@ func resourceGithubBranchDefaultCreate(d *schema.ResourceData, meta interface{}) if err != nil { return err } - if _, _, err := client.Repositories.RenameBranch(ctx, owner, repoName, *repository.DefaultBranch, defaultBranch); err != nil { - return err + + if defaultBranch != *repository.DefaultBranch { + if _, _, err := client.Repositories.RenameBranch(ctx, owner, repoName, *repository.DefaultBranch, defaultBranch); err != nil { + return err + } } } else { repository := &github.Repository{