Skip to content
Latchkey

How to Roll Back a Bad Release in GitHub Actions

gh release delete with --cleanup-tag removes a broken release and its tag, and gh release edit --latest can re-point the latest badge to the last good version.

Take the bad tag as input, run gh release delete <tag> --cleanup-tag --yes, then optionally mark the previous good release as latest. Trigger it from workflow_dispatch.

Steps

  • Accept the bad tag and the previous good tag as inputs.
  • Delete the release and its tag with gh release delete --cleanup-tag.
  • Re-mark the previous release as --latest.

Workflow

.github/workflows/release.yml
on:
  workflow_dispatch:
    inputs:
      bad_tag:
        required: true
      good_tag:
        required: true
permissions:
  contents: write
jobs:
  rollback:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: |
          gh release delete "${{ inputs.bad_tag }}" --cleanup-tag --yes
          gh release edit "${{ inputs.good_tag }}" --latest
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Gotchas

  • Deleting a tag does not unpublish artifacts already pulled by users; yank the package separately.
  • --cleanup-tag removes the git tag too; omit it to keep the tag and delete only the release.

Related guides

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