upload-release-assets icon indicating copy to clipboard operation
upload-release-assets copied to clipboard

Cannot read properties of undefined

Open hirrolot opened this issue 1 year ago • 1 comments

Uploading any file, for example as follows:


jobs:
  build:
    steps:
      - uses: AButler/[email protected]
        with:
          files: "my_file.txt"
          repo-token: ${{ secrets.GITHUB_TOKEN }}

leads to the following error:

Error: Cannot read properties of undefined (reading 'id')

hirrolot avatar Jun 01 '24 16:06 hirrolot

I had the same issue, you can fix it by explicitly passing a value to release-tag:

      - name: ⬆️ Upload the assets
        uses: AButler/[email protected]
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          files: "dist/*;LICENSE"
          release-tag: ${{ github.ref_name }}

It's also possible to fix it using release-id, you will need to send an HTTP GET request to GitHub Public API and parse the JSON response though.

The fallback of this action may work differently depending on the workflow and might not work with the configurations you and I have.

Also, make sure to have contents write permission:

jobs:
  publish:
    permissions:
      contents: write

EchoEllet avatar Jun 22 '24 00:06 EchoEllet