[MAINT] Improve Import behaviour of github_default_branch#3216
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
0e63837 to
a31fc9f
Compare
a31fc9f to
cd4dd3d
Compare
b44b2a4 to
687ec04
Compare
b417ac4 to
055d00c
Compare
There was a problem hiding this comment.
Pull request overview
These provider review instructions are being used.
This PR updates the github_branch_default resource to improve import and rename behavior, modernize the resource implementation to SDKv2 context-aware CRUD, and align logging and tests with current provider patterns.
Changes:
- Refactors
github_branch_defaultto useCreateContext/ReadContext/UpdateContext/DeleteContext, returnsdiag.Diagnostics, and usestflog. - Adds rename-safe repository handling via
repository_id+CustomizeDiff: diffRepository, and updates docs/templates to document the new exported attribute. - Expands acceptance coverage to include update and import scenarios using
statecheck/plancheck.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
github/resource_github_branch_default.go |
Refactors resource to context-aware CRUD + tflog, adds repository_id, custom import handler, and rename-safe diffing. |
github/resource_github_branch_default_test.go |
Adds/updates acceptance tests using modern statecheck/plancheck patterns for create/update/import coverage. |
docs/resources/branch_default.md |
Documents exported repository_id attribute and clarifies import ID format. |
templates/resources/branch_default.md.tmpl |
Mirrors docs updates for generated documentation (repository_id + import wording). |
stevehipwell
left a comment
There was a problem hiding this comment.
Just a quick pre-pass to look at the coding patterns for a re-work. The multi line tflog statements make reviewing harder; as does the type checking but I think we need to keep that (other than for meta in the resource functions).
9d51b80 to
85640c2
Compare
stevehipwell
left a comment
There was a problem hiding this comment.
It looks like the code for the repository_id addition is missing (e.g. migration, import, update ID modification). I'd also suggest that the docs be updated to the new pattern as part of this change given the attributes are being modified.
🤦 Doh! |
efdac3c to
4137ac7
Compare
stevehipwell
left a comment
There was a problem hiding this comment.
If you wait for #3476 to be merged you can reuse the repo ID migration logic.
6b9e94a to
0220d16
Compare
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Removing `etag` after rename made it visible that the GH API is eventually consistent when a branch is being renamed. Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
c9eb706 to
826998a
Compare
Resolves #2613
Before the change?
tflogfor loggingUpdateandImportfunctionalityAfter the change?
tflogfor loggingrepository_idfield and removingForceNewfromrepositoryPull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!