fix: Allow removing runner group networks - #4541
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Add explicit removal flags for organization and enterprise runner group updates, preserving existing omission and string behavior.
9788c28 to
c4d4c88
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4541 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 196 196
Lines 17938 17956 +18
=======================================
+ Hits 17677 17695 +18
Misses 261 261 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| // If true, the network configuration is removed by sending null. | ||
| // This takes precedence over NetworkConfigurationID. | ||
| RemoveNetworkConfiguration bool `json:"-"` |
There was a problem hiding this comment.
If I'm not mistaken, we can solve this in a different way without resorting to adding a new "hidden" field to the struct...
We simply change line 62 above to this:
NetworkConfigurationID *string `json:"network_configuration_id,omitzero"`and then when the user doesn't initialize the field (it is nil), the field will be ignored.
However, if the user wants to REMOVE the network configuration, they would send new("").
I think we should put this in CONTRIBUTING.md on line 418 right after this comment:
For optional boolean fields where you need to distinguish between `false`
and "not set", use `*bool` with `omitzero`.
Add
RemoveNetworkConfigurationto organization and enterprise runner-group update requests, followingUpdateTeamRequest.RemoveParentTeam. Setting it sends"network_configuration_id": nulland takes precedence over a supplied ID. Existing omission and string behavior is unchanged. Creates and responses are untouched.Both PATCH schemas allow null: organization and enterprise.
Needed by integrations/terraform-provider-github#3274.
Regression tests cover omission, strings, explicit null, flag precedence, preservation of other fields, value/pointer marshaling without mutation, and both native PATCH methods. Targeted runner-group tests with
-race, formatting, lint, and generator checks pass on Go 1.26.0. No live detachment was tested.Copilot assisted with implementation, tests, and this description.