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

Fixed renaming if the branch names are identical #2428

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CEbbinghaus
Copy link

Resolves #1904


Before the change?

Applying a default branch rule on a repository that already has a default branch with the same name returns a http error 422 causing the tf apply to fail. This is because we call the RenameBranch api trying to rename main to main

After the change?

We validate that the branch being renamed is different from the current default before we try and rename it

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test to capture this case, or describe manual testing you've done for this?

@CEbbinghaus
Copy link
Author

@kfcampbell Thank you for your feedback, I was looking through the tests and struggled to understand how to integration test with mock calls to the API. I am familiar with Go but haven't yet done any testing with it. Are you able to provide some pointers as to how I could implement the tests?

@CEbbinghaus CEbbinghaus force-pushed the CES/FixWrongfulRename branch from 85abb4b to 90f3c3e Compare December 3, 2024 08:21
@CEbbinghaus
Copy link
Author

@kfcampbell Test has been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: github_branch_default resource fails on creation with rename set to true
3 participants