Fix 422 error when updating release without commitish parameter#144
Fix 422 error when updating release without commitish parameter#144taylorsilva merged 2 commits intoconcourse:masterfrom
Conversation
2b9bcc0 to
b9217d2
Compare
When updating an existing release without providing a commitish parameter, the resource was setting TargetCommitish to an empty string, which GitHub's API rejects with a 422 "Invalid target_commitish parameter" error. This fix mirrors the behavior of the Body field - when commitish is not specified, TargetCommitish is now set to nil instead of an empty string, allowing GitHub to preserve the existing target commit for the release. Signed-off-by: Alan Moran <bonzofenix@gmail.com>
b9217d2 to
6c32a1a
Compare
out_command.go
Outdated
There was a problem hiding this comment.
targetCommitish != ""?
There was a problem hiding this comment.
Using more words:
Instead of introducing a new variable, why not check if targetCommitish != ""?
taylorsilva
left a comment
There was a problem hiding this comment.
Mostly there, just some nit-picks.
out_command.go
Outdated
There was a problem hiding this comment.
Using more words:
Instead of introducing a new variable, why not check if targetCommitish != ""?
out_command.go
Outdated
There was a problem hiding this comment.
The else block is redundant because existingRelease.TargetCommitish will be nil by default.
Signed-off-by: Taylor Silva <dev@taydev.net>
|
I've pushed a commit to your branch which makes the nit-pick changes I suggested. Thanks again for the PR and making this resource more compliant with the Github API. I'll merge once the unit tests in CI are done running. |
When updating an existing release without providing a commitish parameter, the resource was setting TargetCommitish to an empty string, which GitHub's API rejects with a 422 "Invalid target_commitish parameter" error.
This fix mirrors the behavior of the Body field - when commitish is not specified, TargetCommitish is now set to nil instead of an empty string, allowing GitHub to preserve the existing target commit for the release.