actions / upload-release-asset

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

asset id output value not returned from upload #48

Open timstockford opened 4 years ago

timstockford commented 4 years ago

The upload is successful, and the browser_download_url is returned ok (and have tested it downloads the asset OK via the browser), however the asset id value seems to be blank (see screenshot below).

I want to download the asset in a later job as part of CI tests via the github API (to access a draft release asset), for which I need the asset's ID. My workaround is to add additional code to get the asset ID manually via the API, which works but should be unnecessary if the asset id was returned to begin with.

Action Snippet:

    - name: Create Release
      id: create_release
      uses: actions/create-release@latest
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        body: |
          Release generated by Github Actions automatically
        draft: true
        prerelease: false
    - name: Upload Release Asset
      id: release_asset
      uses: actions/upload-release-asset@v1.0.2
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. 
        asset_path: ./files.zip
        asset_name: myfiles.zip
        asset_content_type: application/zip
    - run: |
        echo "ASSET_ID IS ${{ steps.release_asset.outputs.id }}"
        echo "ASSET_BROWSER_DOWNLOAD_URL IS ${{ steps.release_asset.outputs.browser_download_url }}"

Output screenshot: image