fix(ci): release workflow fails with "object does not exist" (HTTP 500) #326
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The
publish-releasejob in.gitea/workflows/release.ymlfails at the "Create release" step with:The empty
idandrel_pathfields indicate Gitea cannot resolve the tag to a git object.Root Cause
The release creation API call is missing the
target_commitishfield in its JSON payload. While the Gitea API docs mark this as optional, in practice Gitea requires it to resolve the tag to a commit object. Without it, Gitea returns an internal server error because it cannot locate the git object backing the tag.Current payload (line ~284):
Missing:
"target_commitish"— should be set to the branch or commit SHA the tag points to.Additionally, the
publish-releasejob does not check out the repository, so it has no local git context. TheBUILD_TAGcomes fromgithub.ref_name || inputs.tag, but forworkflow_dispatchruns the tag may not yet exist on the remote, causing the same resolution failure.See also: go-gitea/gitea#21681
Proposed Fix
Add
target_commitishto the release payload — use${{ github.sha }}(the commit that triggered the workflow) so Gitea can resolve the tag:Pass
GITHUB_SHAinto the env block of thepublish-releasejob:Handle
workflow_dispatchedge case — when a user manually specifies a tag that does not yet exist, the API will create the tag on the target commit. Ensure the SHA comes from the correct branch by checking out the repo or explicitly passing the SHA from the build job.Files to Modify
.gitea/workflows/release.yml— addtarget_commitishto the release creation payload