softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases
MIT License
3.91k stars 440 forks source link

Even with "draft: false", drafts get made #379

Open probonopd opened 11 months ago

probonopd commented 11 months ago

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.

boozook commented 10 months ago

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.

probonopd commented 10 months ago

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?

boozook commented 10 months ago

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

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.

PredatorCZ commented 7 months ago

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.

probonopd commented 7 months ago

Still doesn't seem to work:

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

PredatorCZ commented 7 months ago

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.