Skip to content

feat: Add nightly cleanup of stale draft releases#2239

Merged
charlesvien merged 2 commits into
mainfrom
05-19-add_nightly_cleanup_of_stale_draft_releases
May 20, 2026
Merged

feat: Add nightly cleanup of stale draft releases#2239
charlesvien merged 2 commits into
mainfrom
05-19-add_nightly_cleanup_of_stale_draft_releases

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 20, 2026

Problem

Draft releases left behind by failed or aborted release runs accumulate over time and clutter the releases page.

Changes

  1. Add cleanup-draft-releases.yml workflow
  2. Schedule nightly at 00:00 UTC plus workflow_dispatch for manual runs
  3. List releases via gh api --paginate and filter drafts with created_at older than 24 hours
  4. Delete each match via DELETE /releases/{id}
  5. Use default GITHUB_TOKEN with contents: write, no extra secrets required

How did you test this?

I did not

Publish to changelog?

Copy link
Copy Markdown
Member Author

charlesvien commented May 20, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Add nightly cleanup of stale draft releases feat: Add nightly cleanup of stale draft releases May 20, 2026
@charlesvien charlesvien marked this pull request as ready for review May 20, 2026 05:37
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
.github/workflows/cleanup-draft-releases.yml:22-23
Without `set -o pipefail`, if `gh api --paginate` fails (e.g., auth error, rate limit, network issue), bash reports the exit status of the last command in the pipeline — the `while` loop — which exits 0 on empty input. The step passes silently with no releases deleted and no error surfaced, making failures completely invisible in CI logs.

```suggestion
        run: |
          set -o pipefail
          CUTOFF=$(date -u -d "1 hour ago" +%Y-%m-%dT%H:%M:%SZ)
```

### Issue 2 of 2
.github/workflows/cleanup-draft-releases.yml:18-23
**1-hour cutoff can delete in-progress release drafts**

The `code-release.yml` workflow builds macOS and Windows packages in parallel, each of which can take 30–60+ minutes before `finalize-release` un-drafts the release. When this cleanup is triggered via `workflow_dispatch` at e.g. 1:15 AM UTC and a release started at midnight, the draft would be ~1 hr 15 min old and fall inside the deletion window, mid-build. Consider raising the threshold to something like 24 hours (or at least 3–4 hours) since the scheduled run is daily anyway, which removes the risk without any real downside for stale-draft cleanup.

Reviews (1): Last reviewed commit: "Add nightly cleanup of stale draft relea..." | Re-trigger Greptile

Comment thread .github/workflows/cleanup-draft-releases.yml Outdated
Comment thread .github/workflows/cleanup-draft-releases.yml Outdated
@charlesvien charlesvien force-pushed the 05-19-add_nightly_cleanup_of_stale_draft_releases branch from 1623d47 to a29daf7 Compare May 20, 2026 21:35
@charlesvien charlesvien added the Create Release This will trigger a new release label May 20, 2026
@charlesvien charlesvien removed the Create Release This will trigger a new release label May 20, 2026
Copy link
Copy Markdown
Contributor

adboio commented May 20, 2026

I did not

pog

@charlesvien charlesvien force-pushed the 05-19-add_nightly_cleanup_of_stale_draft_releases branch from a29daf7 to 070c9bf Compare May 20, 2026 22:54
@charlesvien charlesvien merged commit af9a7ef into main May 20, 2026
16 checks passed
@charlesvien charlesvien deleted the 05-19-add_nightly_cleanup_of_stale_draft_releases branch May 20, 2026 23:34
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