Skip to content
Latchkey

gh release delete: Remove a Release in CI

gh release delete deletes a release by tag, with an option to also remove the underlying git tag.

Rollback and re-publish jobs delete a bad release before re-creating it; --cleanup-tag avoids leaving a dangling tag behind.

What it does

gh release delete removes the release object for a tag. By default the git tag remains; --cleanup-tag deletes the tag too. In scripts you must pass --yes to skip the confirmation prompt.

Common usage

Terminal
gh release delete v1.2.0 --yes
gh release delete v1.2.0 --cleanup-tag --yes
gh release delete v1.2.0 -R owner/repo --yes

Flags

FlagWhat it does
-y, --yesSkip the confirmation prompt (required in CI)
--cleanup-tagAlso delete the git tag for the release
-R, --repo <owner/repo>Target a specific repository

In CI

Set GH_TOKEN and permissions: { contents: write }. Without --yes the command tries to prompt and fails on a non-interactive runner. Deleting the release does not delete the tag unless you add --cleanup-tag.

Common errors in CI

"GraphQL: Resource not accessible by integration" or "HTTP 403" means the token lacks contents: write. "release not found" means the tag has no release attached. Without --yes you may see the command hang or exit because no terminal is available to confirm.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →