action-gh-release
action-gh-release copied to clipboard
fix: updating release draft status from true to false
Hi! Thanks for creating this action 😊
One issue I've encountered is that it's currently impossible to use the action to publish a draft issue.
In this PR, I'm trying to address this issue by changing how existingRelease is being looked for from agetReleaseByTag call to iterating through allReleases. Previously, we were only iterating through allReleases if the desired state of the release was draft.
I'd suggest reviewing with whitespace changes hidden: https://github.com/softprops/action-gh-release/pull/316/files?diff=split&w=1
Testing
- [x] used the updated action to publish draft release here: https://github.com/protocol/.github-test-target/actions/runs/4068545498
@galargh can you fix the merge conflicts? Thanks!
Of course! Done :) The diff is much cleaner now.
One possible optimisation for some use cases could be to:
- Try retrieving the release by tag
- If 1. fails, iterate through all the releases
Let me know if you want me to add that.
also can you post some examples of how this PR (by pointing to the latest commit of this PR) being used.
Hey there, thank you all for both maintaining and contributing to this action, we use it and it is helpful!
Here's an example of using this PR in practice: https://github.com/pantsbuild/scie-pants/pull/444 (note that we're using a custom fork but it's literally just v2.0.9 + this PR's code merged in)
The resulting workflow is: https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/.github/workflows/release.yml
- the
github-releasematrix job creates a bunch ofdraft: truereleases: https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/.github/workflows/release.yml#L98-L113 - the
publish-announce-releasejob takes that same release and setsdraft: false(along with a few other "publishing" actions): https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/.github/workflows/release.yml#L136-L147
I hope that provides some reassurance that this code seems to be functioning correctly in practice.
(As I said above, thanks for maintaining and contributing.)
Thanks @huonw for the context.