Skip to content

refactor!: Pass DeploymentRequest and DeploymentStatusRequest by value#4361

Open
JamBalaya56562 wants to merge 4 commits into
google:masterfrom
JamBalaya56562:refactor/3644-deployment-value-params
Open

refactor!: Pass DeploymentRequest and DeploymentStatusRequest by value#4361
JamBalaya56562 wants to merge 4 commits into
google:masterfrom
JamBalaya56562:refactor/3644-deployment-value-params

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

This is a follow-up to #3644, converting repos_deployments.go to the established value-parameter pattern:

  • CreateDeployment and CreateDeploymentStatus now take their request bodies (DeploymentRequest, DeploymentStatusRequest) by value instead of by pointer.
  • The schema-required fields are now non-pointers with omitempty removed: DeploymentRequest.Ref (ref is required by the create-a-deployment request schema) and DeploymentStatusRequest.State (state is required by the create-a-deployment-status request schema).
  • Both types are removed from the paramcheck allowlist in .golangci.yml (custom-gcl run ./... reports 0 issues).
  • A second commit adds the missing optional TargetURL field to DeploymentStatusRequest (target_url is present in the OpenAPI request schema; the API docs recommend log_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: CreateDeployment and CreateDeploymentStatus now take DeploymentRequest and DeploymentStatusRequest by value instead of by pointer; the required fields DeploymentRequest.Ref and DeploymentStatusRequest.State are now string instead of *string, and DeploymentRequest.RequiredContexts is now []string instead of *[]string.

…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.
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Jul 4, 2026
@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (1cb3999) to head (afa76ce).
⚠️ Report is 1 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

Comment thread github/repos_deployments.go Outdated
Comment thread github/repos_deployments.go Outdated
Change `DeploymentRequest.RequiredContexts` from `*[]string` to a plain
`[]string` and drop its structfield exception. Use `omitzero` so an
explicit empty slice is still sent, which the API interprets as
bypassing commit status checks. Rename the `deployment` parameter of
`CreateDeploymentStatus` to `deploymentID`.
@JamBalaya56562 JamBalaya56562 requested a review from alexandear July 4, 2026 15:25
Comment thread github/repos_deployments.go Outdated
The other DeploymentRequest fields are undocumented, so remove the
comment added in the previous commit to keep the struct consistent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants