Skip to content

Commit

Permalink
Added check to Create too
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Dec 3, 2024
1 parent 3c3e668 commit cdab906
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions github/resource_github_branch_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit cdab906

Please sign in to comment.