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 release draft status from true to false #316

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

galargh
Copy link

@galargh galargh commented Feb 1, 2023

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

@chenrui333 chenrui333 added the bug Something isn't working label Jun 19, 2024
@chenrui333
Copy link
Collaborator

@galargh can you fix the merge conflicts? Thanks!

@galargh
Copy link
Author

galargh commented Jul 17, 2024

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.

Copy link
Collaborator

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, can you add some tests as well?

@chenrui333
Copy link
Collaborator

chenrui333 commented Jul 19, 2024

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

huonw added a commit to pantsbuild/scie-pants that referenced this pull request Dec 12, 2024
…` -> `false` transition (#444)

This works around `softprops/action-gh-release` not being able to
properly "publish" a release by changing `draft: true` to `draft:
false`.

The intention is that the step with `draft: false` would find the
existing draft release and update it (publishing it). This is what
correctly happened for a testing `v0.12.3-beta.3` release from this
branch:
https://github.com/pantsbuild/scie-pants/releases/tag/v0.12.3-beta.3 (I
also did attempted a `v0.12.3-beta.2` from this branch, but that used a
newer version of the action code and failed completely, see below.)

Previously, the action would fail to find the existing draft release and
instead create a duplicate one. The old behaviour is visible (to people
who can see draft releases) with `v0.12.3-beta.0` and `-beta.1`.

The particular new version of the action is:

- changes:
softprops/action-gh-release@master...huonw:action-gh-release:huonw/pantsbuild-fix-see-scie-pants-439
(specifically commit
huonw/action-gh-release@998f80d
from branch
https://github.com/huonw/action-gh-release/commits/huonw/pantsbuild-fix-see-scie-pants-439
)
- this is v2.0.9 (the current `v2` tag) with
softprops/action-gh-release#316 merged in
- using v2.2.0 (the latest version of the action) fails while uploading
artifacts with errors like `Request body length does not match
content-length header`, so this sticks with the older version.
@huonw
Copy link

huonw commented Dec 12, 2024

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: pantsbuild/scie-pants#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

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.)

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.

3 participants