refactor!: Pass DeploymentRequest and DeploymentStatusRequest by value#4361
Open
JamBalaya56562 wants to merge 2 commits into
Open
refactor!: Pass DeploymentRequest and DeploymentStatusRequest by value#4361JamBalaya56562 wants to merge 2 commits into
DeploymentRequest and DeploymentStatusRequest by value#4361JamBalaya56562 wants to merge 2 commits into
Conversation
…value Pass the request bodies of `CreateDeployment` and `CreateDeploymentStatus` by value instead of by pointer, and make the schema-required fields `DeploymentRequest.Ref` and `DeploymentStatusRequest.State` non-pointers. Remove both types from the paramcheck allowlist in .golangci.yml.
The create-deployment-status request body accepts a `target_url` property that was missing from the struct. Add it as an optional field; the API docs recommend `log_url`, which replaces it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4361 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 193 193
Lines 19519 19519
=======================================
Hits 19033 19033
Misses 269 269
Partials 217 217 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gmlewis
approved these changes
Jul 4, 2026
gmlewis
left a comment
Collaborator
There was a problem hiding this comment.
Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
alexandear
reviewed
Jul 4, 2026
| Ref string `json:"ref"` | ||
| Task *string `json:"task,omitempty"` | ||
| AutoMerge *bool `json:"auto_merge,omitempty"` | ||
| RequiredContexts *[]string `json:"required_contexts,omitempty"` |
Contributor
There was a problem hiding this comment.
Please also fix this:
Suggested change
| RequiredContexts *[]string `json:"required_contexts,omitempty"` | |
| RequiredContexts []string `json:"required_contexts,omitempty"` |
And do not forget to remove the line from .golangci.yml:
- DeploymentRequest.RequiredContexts # TODO: Deployments| // | ||
| //meta:operation POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses | ||
| func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, body *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { | ||
| func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, body DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { |
Contributor
There was a problem hiding this comment.
Suggested change
| func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, body DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { | |
| func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deploymentID int64, body DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #3644, converting
repos_deployments.goto the established value-parameter pattern:CreateDeploymentandCreateDeploymentStatusnow take their request bodies (DeploymentRequest,DeploymentStatusRequest) by value instead of by pointer.omitemptyremoved:DeploymentRequest.Ref(refis required by the create-a-deployment request schema) andDeploymentStatusRequest.State(stateis required by the create-a-deployment-status request schema)..golangci.yml(custom-gcl run ./...reports 0 issues).TargetURLfield toDeploymentStatusRequest(target_urlis present in the OpenAPI request schema; the API docs recommendlog_url, which replaces it).Both method names already match the GitHub docs operation names ("Create a deployment", "Create a deployment status"), so no renames are needed.
Updates #3644.
BREAKING CHANGE:
CreateDeploymentandCreateDeploymentStatusnow takeDeploymentRequestandDeploymentStatusRequestby value instead of by pointer; the required fieldsDeploymentRequest.RefandDeploymentStatusRequest.Stateare nowstringinstead of*string.