Skip to content

Commit

Permalink
Fixed renaming if the branch names are identical
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Oct 15, 2024
1 parent 61d0821 commit c3c2480
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions github/resource_github_branch_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ func resourceGithubBranchDefaultUpdate(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}

// We don't want to rename branch if its already the default branch
if defaultBranch == *repository.DefaultBranch {
return nil
}

if _, _, err := client.Repositories.RenameBranch(ctx, owner, repoName, *repository.DefaultBranch, defaultBranch); err != nil {
return err
}
Expand Down

0 comments on commit c3c2480

Please sign in to comment.