Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

asset id output value not returned from upload #48

Open
timstockford opened this issue Apr 30, 2020 · 0 comments · Fixed by birjj/upload-release-asset#1
Open

asset id output value not returned from upload #48

timstockford opened this issue Apr 30, 2020 · 0 comments · Fixed by birjj/upload-release-asset#1

Comments

@timstockford
Copy link

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/[email protected]
      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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant