octokit / request-action

A GitHub Action to send arbitrary requests to GitHub's REST API
https://github.com/marketplace/actions/GitHub-API-Request
MIT License
377 stars 47 forks source link

Upload release asset #96

Closed cb80 closed 3 years ago

cb80 commented 3 years ago

Dear all,

I am trying to upload a binary file to a release. I have retrieved the release structure in a previous step called rel. This is what I have:

    - uses: octokit/request-action@v2.x
      with:
        route: POST ${{ fromJson(steps.rel.outputs.data).upload_url }}
        name: mybinary
        data: path/to/mybinary
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

It works great except that the uploaded file does not contain the bytes of the file. Instead it contains the string path/to/mybinary. So how can I actually upload a file?

PS: The whole pipeline is a little more complicated but I tried to condense it in a http://sscce.org/ manner.

gr2m commented 3 years ago

The upload a release asset endpoint is tricky. There are several alternative actions you can use for that exact use case, maybe one of them will work for you?

https://github.com/marketplace?type=actions&query=upload+release+asset

cb80 commented 3 years ago

Thanks a lot @gr2m. I have not found a good method to read the file data to pass them to the endpoint. I meanwhile wrote my own action which was a good decision: