Skip to content

Add script to delete automated GitHub releases while preserving tags#6683

Open
masenf wants to merge 2 commits into
mainfrom
claude/festive-babbage-rwi9kn
Open

Add script to delete automated GitHub releases while preserving tags#6683
masenf wants to merge 2 commits into
mainfrom
claude/festive-babbage-rwi9kn

Conversation

@masenf

@masenf masenf commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Type of change

  • New feature (non-breaking change which adds functionality)

Description

This PR adds a utility script (scripts/delete_automated_releases.sh) to clean up automatically-generated GitHub Releases while preserving their underlying git tags.

Problem: The automated and dispatch release CI workflows create one Release entry per sub-package version bump, cluttering the Releases page.

Solution: The new script identifies and deletes Release objects whose body starts with "Automated release for" or "Dispatch release for", while keeping the git tags intact (by never passing --cleanup-tag to gh release delete). This preserves pip installs, changelog links, and other references that depend on the tags.

Features:

  • Dry-run mode by default (lists matches without deleting)
  • --apply flag to enable deletion with confirmation prompt
  • --yes flag to skip confirmation
  • --repo flag to target a different repository
  • Backs up matching releases to JSON before deletion for inspection/recovery
  • Requires gh CLI and jq; validates authentication and tool availability

Changes:

  • Added scripts/delete_automated_releases.sh with comprehensive documentation and error handling
  • Updated .gitignore to exclude backup files created by the script

Testing

No testing needed — this is a utility script for repository maintenance. The script includes built-in validation (checks for required tools, authentication, and provides dry-run mode for safe preview).

Checklist

https://claude.ai/code/session_01GuovjAVb7evQGBXY7ZRkXx

Add scripts/delete_automated_releases.sh, which finds every GitHub Release
whose body starts with "Automated release for" or "Dispatch release for"
(the markers emitted by the automated/dispatch release CI workflows) and
deletes the Release entries via the gh CLI, leaving the underlying git tags
intact (it never passes `gh release delete --cleanup-tag`).

The script enumerates releases dynamically with `gh api --paginate`, defaults
to a dry run that only lists matches, requires --apply (plus a confirmation
prompt unless --yes) to delete, and backs up the matching release objects to
JSON before deleting. The backup file is gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GuovjAVb7evQGBXY7ZRkXx
@masenf masenf requested a review from a team as a code owner June 26, 2026 00:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acb590e7cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


# Body prefixes that identify an auto-generated release. Matching is exact
# (no leading-whitespace tolerance). Add/remove entries here to adjust scope.
PREFIXES=("Automated release for" "Dispatch release for")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve top-level dispatch releases

When this cleanup is run with --apply, matching the broad Dispatch release for prefix also selects top-level Reflex releases: .github/scripts/dispatch_release/create_release.sh writes that prefix for every dispatch release, and the dispatch planner appends a package: "reflex" release with a v... tag whenever reflex-base is released; those Reflex releases are the only dispatch releases not forced to --latest=false. Please exclude the reflex/v... dispatch releases or otherwise restrict this matcher to the sub-package releases intended to be removed, otherwise the script will delete the main GitHub Release entries from the Releases page.

Useful? React with 👍 / 👎.

@codspeed-hq

codspeed-hq Bot commented Jun 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing claude/festive-babbage-rwi9kn (541b65e) with main (8b56f52)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds scripts/delete_automated_releases.sh, a maintenance utility that bulk-deletes the GitHub Release UI entries created by automated CI workflows while explicitly preserving all underlying git tags, and updates .gitignore to exclude the timestamped backup files the script produces.

  • The script correctly scopes deletions to releases whose body matches known auto-generated prefixes, and explicitly keeps top-level non-pre-release vX.Y.Z entries; set -euo pipefail, safe jq --arg encoding, and a dry-run default make it well-guarded for a maintenance tool.
  • Previous review concerns (backup overwrite on retry, --yes-without---apply giving no feedback) are both addressed in this revision with timestamped backup filenames and an explicit notice message.

Confidence Score: 5/5

Safe to merge — the script is a dry-run-by-default maintenance utility that operates only on GitHub Release metadata and never touches git tags.

The change introduces a standalone maintenance script that deletes GitHub Release UI entries without touching git tags. The logic is well-guarded with set -euo pipefail, dry-run default, timestamped backups, and a confirmation prompt. No existing application code is modified.

No files require special attention.

Important Files Changed

Filename Overview
scripts/delete_automated_releases.sh New maintenance utility that deletes automated GitHub Release entries while preserving tags; logic is sound, set -euo pipefail is used correctly, jq injection is handled via --arg, and both previous concerns (timestamped backups, --yes-without---apply notice) are already addressed.
.gitignore Adds a glob pattern to exclude timestamped backup files written by the new script; straightforward and correct.

Reviews (2): Last reviewed commit: "Preserve top-level non-prerelease releas..." | Re-trigger Greptile

Comment thread scripts/delete_automated_releases.sh
Comment thread scripts/delete_automated_releases.sh Outdated
Restrict the deletion scope so the script never removes top-level reflex
releases (the main package's bare "vX.Y.Z" tags) unless they are
pre-releases. The "Dispatch release for" prefix matches the main package's
release entries too (the dispatch planner appends a `package: "reflex"`
release whenever reflex-base is released, and those are the only dispatch
releases not marked --latest=false), so the previous filter would have
removed finalized core entries like v0.9.5 from the Releases page. Top-level
alpha pre-releases (e.g. v0.9.4a1) and all sub-package releases remain in
scope.

Also address two review nits:
- Timestamp the backup filename so retrying after a partial failure no
  longer clobbers an earlier run's backup (gitignore glob still matches).
- Print a note when --yes is passed without --apply, which is otherwise a
  silent no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GuovjAVb7evQGBXY7ZRkXx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants