octokit / request-action

A GitHub Action to send arbitrary requests to GitHub's REST API

Home Page:https://github.com/marketplace/actions/GitHub-API-Request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upload release asset

cb80 opened this issue · comments

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.

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

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: