svenstaro / upload-release-action

Upload files to a GitHub release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Validation Failed" with overwrite: true

retorquere opened this issue · comments

I have this upload-release-action stanza in my workflow:

    - name: publish repo
      id: publish
      if: steps.repo.outputs.rebuilt == 'true'
      uses: svenstaro/upload-release-action@v2
      with:
        tag: apt-get-test
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file_glob: true
        overwrite: true
        file: repo/*

but I'm consistently getting

Validation Failed: {"resource":"ReleaseAsset","code":"already_exists","field":"name"}

Does this release happen to have more than, say, 30 assets?

If so, I suspect the issue is that octokit.repos.listReleaseAssets() needs to be wrapped with one of the pagination functions.

Does this release happen to have more than, say, 30 assets?

That is correct.

I have a similar issue but a different error message. I believe the problem is related so I would not open an extra issue but if you think it would be better to organize, I can do so.

      - name: Upload release assets
        uses: svenstaro/upload-release-action@v2
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ steps.build_tag.outputs.tag }}
          file: ./rel/*
          file_glob: true
          overwrite: true
          body: "Github Actions Auto-Release"

With the validation error:

Error: Validation Failed: {"resource":"ReleaseAsset","code":"custom","field":"size","message":"size is not included in the list"}

I do not have more than 30 files in the asset.

@AndreG-P The easy way to tell would be to try the version in the pull request (djpohly/upload-release-action@paginate-assets). If that doesn't fix your problem, then it's probably a different issue.

@djpohly Unfortunately, it did not help. Should I open another issue for that?

      - name: Upload release assets
        uses: djpohly/upload-release-action@paginate-assets
        with:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ steps.build_tag.outputs.tag }}
          file: ./rel/*
          file_glob: true
          overwrite: true
          body: "Github Actions Auto-Release"

The error didn't change:

Error: Validation Failed: {"resource":"ReleaseAsset","code":"custom","field":"size","message":"size is not included in the list"}

@AndreG-P I assume so. If it needs a different fix, it's probably a separate issue.

@djpohly I discovered that my release accidentally contained an empty file (0 bytes) which leads to this cryptic error message. I don't know if this is worth documenting or well-known behavior. Anyhow, my problem is fixed. Thanks for the help anyway.