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

Even with "draft: false", drafts get made

Open probonopd opened this issue 2 years ago • 6 comments

I am using this:

    - name: Upload Artifacts to GitHub Releases
      uses: softprops/action-gh-release@v1
      with:
        files: |
          build/attrutil
        tag_name: continuous
        target_commitish: ${{ github.sha }}
        draft: false

https://github.com/probonopd/attrutil/blob/main/.github/workflows/build.yml

I was hoping that thanks to draft: false, the releases would not be created as drafts, but they are.

probonopd avatar Aug 14 '23 22:08 probonopd

I suppose that there's Github's "boo is not bool"-problem. Try to use strings like 'false' or if you really need bool - pass empty string "" or ${{ null }}, so it casts to boolean as false.

boozook avatar Sep 14 '23 13:09 boozook

Thanks @boozook. Is this a change @softprops would need to make in this action, or should it work if I simply set draft: ${{ null }} instead of draft: false?

probonopd avatar Sep 16 '23 08:09 probonopd

@probonopd, looking at that line I suppose the value is interpreting as following:

  • true if value == "true" (string)
  • false (actually undefined, sic!) for any other value.

Also there input is defined as empty by default.

So in this case for false I could try ${{ null }} or empty string as by default.

Anyway, it's just my suppose, I'm not sure and I'm not a guru of this language.

FYI: As I remember "false" casts to bool as true because in bytes this isn't empty or zero. For example "0" == false => true.

boozook avatar Sep 16 '23 13:09 boozook

I've had the same issue. I am using the same workflow (remove tag + release, then release again). draft is false by default, so there is no need to explicitly specify it. I've fixed this issue by putting sleep between deletion and release steps. (In your example on this line: https://github.com/probonopd/attrutil/blob/a87a383bcd9061fee192208572de9fae3a141e8b/.github/workflows/build.yml#L37)

Very simple code:

    - name: Wait a sec
      run: sleep 2

Sleep variable should be tweaked

The reasoning for sleep is, that GH API is slower then action script, so by the time CI is releasing, deletion is still queued on gh side. But that is just a silly theory of mine.

PredatorCZ avatar Dec 09 '23 09:12 PredatorCZ

Still doesn't seem to work:

https://github.com/probonopd/attrutil/releases

probonopd avatar Dec 10 '23 12:12 probonopd

I'm also using delete-tag-and-release action instead of git command to remove previous releases. Or/and increase wait time, 2s delay is working for me, that doesn't mean it's the rule.

PredatorCZ avatar Dec 12 '23 00:12 PredatorCZ