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 updating draft releases #255

Closed
wants to merge 3 commits into from
Closed

Conversation

vadz
Copy link

@vadz vadz commented Sep 4, 2022

Sorry again, after opening #254 and then closing it because I've noticed the already existing #245, I'm finally opening this one because, after looking at #245, I believe this one is slightly better because it correctly uses createRelease() if a draft release does not exist, rather than using updateRelease() even in this case. Even if the latter works too, using createRelease() looks preferable and, at the very least, results in the expected message in the logs.

I've also changed the way we're looking for the existing draft release in this one because using the (empty) tag doesn't seem to be the right thing to do neither.

Please note that although it looks like there are many changes here, using git diff -w --color-moved --color-words shows that most of them are actually due to just moving the code around.

vadz added 3 commits February 9, 2023 01:23
No real changes yet, this is just a small cleanup before the upcoming
commits.
The tag is typically (or maybe even always) empty for the draft
releases and can't be really used, while the release name will normally
be unique, so use it as the key.
Don't just return the release without doing anything else, notably this
didn't allow updating an existing draft release body.

This change required refactoring the code to use a new helper
find_existing_release() function, but the only effective change is that
the main release() function doesn't return early any more if a draft
release already exists.

This commit is best viewed ignoring whitespace-only changes and using
git --color-moved option.
@vadz vadz force-pushed the fix-draft-update branch from 1460c8b to 4c1f6af Compare February 9, 2023 00:24
@vadz
Copy link
Author

vadz commented Feb 9, 2023

I've rebased the original branch on the latest master to avoid conflicts due to formatting changes.

Please let me know if you have any questions or comments about this PR, it would be really nice to see it merged.

@chenrui333
Copy link
Collaborator

@vadz can you fix the merge conflicts? Thanks!

@vadz
Copy link
Author

vadz commented Jul 17, 2024

There are too many conflicts with fb2d031 (Fix missing update release body (#365), 2024-07-17) and I think that PR fixed the same problem, albeit in a somewhat different way. I haven't tested if it's really fixed for me yet however, but if there are no known problems with the other PR, this one can be closed.

@chenrui333
Copy link
Collaborator

@vadz sounds great, feel free to throw another PR. Thanks!

@chenrui333 chenrui333 closed this Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants