actions / upload-release-asset

An Action to upload a release asset via the GitHub Release API
MIT License
683 stars 187 forks source link

Error uploading to https://github.our_enterprise.com/storage/releases/xxxx/files: 404 #72

Open s850042002 opened 3 years ago

s850042002 commented 3 years ago

We're testing this action in our github enterprise environment, but we keep getting the following error message.

Run actions/upload-release-asset@v1
  with:
    upload_url: https://github.our_enterprise.com/api/uploads/repos/our_rganization/ConsoleAction/releases/2251/assets{?name,label}
    asset_path: ./ConsoleAction_x64.zip
    asset_name: ConsoleAction_x64.zip
    asset_content_type: application/zip
  env:
    GITHUB_TOKEN: ***
##[error]Error uploading to https://github.our_enterprise.com/storage/releases/2251/files: 404

We use the example code without any modification. And confirm the artifact exist.

      - name: Create Release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }} 
          release_name: Release ${{ github.ref }}

      - name: Upload Release Asset (x64)
        id: upload-release-asset-x64
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./ConsoleAction_x64.zip
          asset_name: ConsoleAction_x64.zip
          asset_content_type: application/zip

Why does it upload the artifact to https://github.our_enterprise.com/storage/release? And how do we fix it?

MarcusNotheis commented 3 years ago

Hey, I came across the same issue and was able to work around it by using my personal access token instead of the default ${{ secrets.GITHUB_TOKEN }}. With ${{ secrets.GITHUB_TOKEN }} I got the 404 error as well, with ${{ secrets.MY_SECRET_NAME_WITH_MY_TOKEN }} it worked find. Could it be that the secrets.GITHUB_TOKEN has insufficient privileges for uploading release assets in GitHub Enterprise environments? We are running GitHub Enterprise Server 2.22.6.