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 Oct 15, 2024
1 parent 354adbb commit 4ab392a
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 4ab392a

Please sign in to comment.