Skip to content

Conversation

@bonzofenix
Copy link

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.

@bonzofenix bonzofenix requested a review from a team as a code owner October 27, 2025 18:32
@bonzofenix bonzofenix force-pushed the fix-commitish-422-error branch from 2b9bcc0 to b9217d2 Compare November 7, 2025 13:17
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 <[email protected]>
@bonzofenix bonzofenix force-pushed the fix-commitish-422-error branch from b9217d2 to 6c32a1a Compare November 7, 2025 13:21
existingRelease.Draft = github.Bool(draft)
existingRelease.Prerelease = github.Bool(prerelease)

if commitishSpecified {
Copy link
Contributor

Choose a reason for hiding this comment

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

targetCommitish != ""?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants