action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

fix: updating release draft status from true to false

Open galargh opened this issue 2 years ago • 3 comments

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 avatar Feb 01 '23 21:02 galargh

@galargh can you fix the merge conflicts? Thanks!

chenrui333 avatar Jul 17 '24 18:07 chenrui333

Of course! Done :) The diff is much cleaner now.

One possible optimisation for some use cases could be to:

  1. Try retrieving the release by tag
  2. If 1. fails, iterate through all the releases

Let me know if you want me to add that.

galargh avatar Jul 17 '24 20:07 galargh

also can you post some examples of how this PR (by pointing to the latest commit of this PR) being used.

chenrui333 avatar Jul 19 '24 12:07 chenrui333

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-release matrix job creates a bunch of draft: true releases: https://github.com/pantsbuild/scie-pants/blob/9d73b15a0f602de1359c842a7b153b1dda53c7e9/.github/workflows/release.yml#L98-L113
  • the publish-announce-release job takes that same release and sets draft: 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.)

huonw avatar Dec 12 '24 02:12 huonw

Thanks @huonw for the context.

chenrui333 avatar Apr 10 '25 15:04 chenrui333