Skip to content
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

πŸ› Fix release deletion #2

Merged
merged 3 commits into from
May 18, 2020
Merged

πŸ› Fix release deletion #2

merged 3 commits into from
May 18, 2020

Conversation

bjeanes
Copy link
Contributor

@bjeanes bjeanes commented May 17, 2020

With this change, release is correctly deleted:

Run bjeanes/delete-tag-and-release@fix-release-deletion
🏷  given tag is "unstable"
🍻  found 1 releases to delete
πŸ‘πŸΌ  all releases deleted successfully!
βœ…  unstable deleted successfully!

GitHub converts a release into draft status when its underlying tag is deleted.

This means that the release deletion code ignored candidate releases for deletion
both because it was a draft (draft === false) and because it was no longer
associated with any tag
.

Additionally, one of the parameters passed to fetch() was incorrect (url -> path) and its return type was misinterpreted.

Fixes #1

GitHub converts a release into draft status when its underlying tag is deleted.

This means that the release deletion code ignored candidate releases for deletion
both because it was a draft (`draft === false`) and because it was no longer
associated with any tag.
It seems like this might have been broken in a refactoring of sorts.
@dev-drprasad
Copy link
Owner

Thanks for catching the bug and PR!

Since deleteReleases and deleteTag are both async function, both API requests happen asynchronously. So, we may face race condition. Tag may get deleted before releases and releases will end up in draft state which is, this PR actually trying to solve. To fix this, you can await, deleteReleases func.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@bjeanes
Copy link
Contributor Author

bjeanes commented May 18, 2020

Good spot on that race condition! Thanks :)

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.

It does not delete the release
2 participants