Skip to content

feat: Add functionality to update github_branch_default instead of forcing replacement#2911

Merged
nickfloyd merged 10 commits intointegrations:mainfrom
thisispr:feature/allow-change-default-branch
Nov 25, 2025
Merged

feat: Add functionality to update github_branch_default instead of forcing replacement#2911
nickfloyd merged 10 commits intointegrations:mainfrom
thisispr:feature/allow-change-default-branch

Conversation

@thisispr
Copy link
Copy Markdown
Contributor

@thisispr thisispr commented Nov 17, 2025

Resolves #ISSUE_NUMBER


Before the change?

image

After the change?

image

Pull request checklist

  • Schema migrations have been created if needed (example)
  • 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

@github-actions github-actions bot added the Type: Feature New feature or request label Nov 17, 2025
@thisispr thisispr force-pushed the feature/allow-change-default-branch branch from 5431426 to e90dc61 Compare November 17, 2025 18:07
@thisispr thisispr changed the title feat: Add update functionality to rename existing GitHub branches and update documentation feat: Add update functionality to rename existing GitHub branches Nov 17, 2025
@thisispr thisispr changed the title feat: Add update functionality to rename existing GitHub branches feat: Add update functionality to github_branch_default instead of forcing replacement Nov 17, 2025
@thisispr thisispr changed the title feat: Add update functionality to github_branch_default instead of forcing replacement feat: Add functionality to update github_branch_default instead of forcing replacement Nov 17, 2025
@nickfloyd nickfloyd moved this from Backlog to BLOCKED in Terraform Provider Nov 19, 2025
@nickfloyd
Copy link
Copy Markdown
Member

@thisispr Thank you for this change. ❤️ When you get the chance run gofmt to fix the ci failure and I'll give this a proper review.

@nickfloyd nickfloyd moved this from BLOCKED to In Review in Terraform Provider Nov 20, 2025
@nickfloyd nickfloyd added this to the v6.x version wrap up milestone Nov 20, 2025
@thisispr thisispr requested a review from nickfloyd November 21, 2025 17:01
Copy link
Copy Markdown
Collaborator

@diofeher diofeher left a comment

Choose a reason for hiding this comment

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

@thisispr This looks really good, thanks for the contribution!

I just wanted to ask you one extra thing: can you create two extra unit tests to ensure the resource is:

  1. Updated if branch was changed;
  2. Recreated if other fields were changed;

There's a similar example here:

t.Run("destroyOnDrift false clears sensitive values instead of recreating", func(t *testing.T) {
originalTimestamp := "2023-01-01T00:00:00Z"
newTimestamp := "2023-01-02T00:00:00Z"
d := schema.TestResourceDataRaw(t, resourceGithubActionsSecret().Schema, map[string]any{
"repository": "test-repo",
"secret_name": "test-secret",
"plaintext_value": "original-value",
"encrypted_value": "original-encrypted",
"destroy_on_drift": false,
"updated_at": originalTimestamp,
})
d.SetId("test-secret")
// Simulate drift detection logic when destroy_on_drift is false
destroyOnDrift := d.Get("destroy_on_drift").(bool)
storedUpdatedAt, hasStoredUpdatedAt := d.GetOk("updated_at")
if hasStoredUpdatedAt && storedUpdatedAt != newTimestamp {
if destroyOnDrift {
// Would clear ID for recreation
d.SetId("")
} else {
// Should clear sensitive values to trigger update
_ = d.Set("encrypted_value", "")
_ = d.Set("plaintext_value", "")
}
_ = d.Set("updated_at", newTimestamp)
}

@diofeher diofeher self-assigned this Nov 23, 2025
@thisispr thisispr requested a review from diofeher November 24, 2025 14:03
@thisispr thisispr force-pushed the feature/allow-change-default-branch branch from 3e4646d to 37db1fd Compare November 24, 2025 17:20
Copy link
Copy Markdown
Collaborator

@diofeher diofeher left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! @thisispr

@nickfloyd nickfloyd dismissed their stale review November 25, 2025 17:52

Changes have been made

@nickfloyd nickfloyd merged commit 9bc2646 into integrations:main Nov 25, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Terraform Provider Nov 25, 2025
@thisispr
Copy link
Copy Markdown
Contributor Author

thisispr commented Dec 3, 2025

@nickfloyd @diofeher any info, when you will release a new update. I'm waiting to use this feature :)

@diofeher
Copy link
Copy Markdown
Collaborator

diofeher commented Dec 3, 2025

@thisispr As far as I know, we're planning to release as soon as this is completed https://github.com/integrations/terraform-provider-github/milestone/61

@thisispr thisispr deleted the feature/allow-change-default-branch branch December 3, 2025 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

3 participants