-
Notifications
You must be signed in to change notification settings - Fork 24
ci(fix): delete branch prereleases started in prior versions on merge to main #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
zimeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Leaving a note on the updated command used, but am avoiding much detail in the logic below for the sake of reviewing!
| echo "Identified pre-release tagname to 🔪: $TAG_NAME" | ||
| # Delete the pre-release | ||
| GH_DEBUG=1 gh release --repo slackapi/slack-cli delete $TAG_NAME -y --cleanup-tag | ||
| RELEASES=$(gh release list --repo="slackapi/slack-cli" --order="desc" --json="tagName" --exclude-drafts --exclude-pre-releases --limit=6 --jq ".[] | .tagName") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command is similar to the one before, but now lists more recent releases:
$ gh release list --repo="slackapi/slack-cli" --order="desc" --json="tagName" --exclude-drafts --exclude-pre-releases --limit=6 --jq ".[] | .tagName"
v3.0.4
v3.0.3
v3.0.2There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome find! Any reason why you chose --limit 6? It looks like the default is --limit 30 which could prevent undeleted pre-releases further back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mwbrooks Hmm I'm glad you called this out! 🤔
I agree 6 seems to be not enough releases, but I also wanted to limit this to avoid rate limits in the following loop if the branch isn't found.
That might have a better workaround though...
Keeping some --limit feels right to me since the default isn't clear otherwise, and this is now 24 which should cover more branches!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
==========================================
- Coverage 62.81% 62.79% -0.02%
==========================================
Files 210 210
Lines 22053 22053
==========================================
- Hits 13852 13848 -4
- Misses 7121 7127 +6
+ Partials 1080 1078 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
📣 If these changes seem alright and this merges, I will clean up the existing prereleases that should've been deleted. I notice theses appear here: |
hello-ashleyintech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
mwbrooks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Absolutely incredible find @zimeg! I can't imagine how difficult it was to track down the issue to old releases 👏🏻
✏️ Left a minor question, but non-blocking to merging this PR!
| echo "Identified pre-release tagname to 🔪: $TAG_NAME" | ||
| # Delete the pre-release | ||
| GH_DEBUG=1 gh release --repo slackapi/slack-cli delete $TAG_NAME -y --cleanup-tag | ||
| RELEASES=$(gh release list --repo="slackapi/slack-cli" --order="desc" --json="tagName" --exclude-drafts --exclude-pre-releases --limit=6 --jq ".[] | .tagName") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome find! Any reason why you chose --limit 6? It looks like the default is --limit 30 which could prevent undeleted pre-releases further back?
|
@hello-ashleyintech @mwbrooks Thank y'all both for the reviews and feedback 👾 ✨ Once tests are passing I will merge this and delete past pre-releases if these changes delete this pre-release as expected! |
|
🪓 https://github.com/slackapi/slack-cli/actions/runs/14321328571/job/40138683904 |
|
📝 Deleting But this seems specific to these manual deletions and not merges otherwise? I'll keep watch of this and follow up as needed 🫡 Edit: https://github.com/slackapi/slack-cli/actions/runs/14321530256/job/40139248428 |
Summary
This PR fixes an issue where branch prereleases aren't deleted after a merge to
mainif the prerelease tag starts with a version from before the latest release.Preview
In this example, we have multiple releases, a few stable tags, and some lingering releases. From most recent to least:
Which lines up with when the "build" branches were started - before
v3.0.3- and when these merged afterv3.0.3.The changes within check the last
6stable releases for a matching branch name to decide which release to delete. This is bound to PRs that haven't gone "stale" while also avoiding perhaps unexpected deletes of long past releases. TBH that should never happen.Notes
Requirements