actions / upload-artifact

MIT License
3.01k stars 683 forks source link

[bug]??? The id and url is returning blank even I can see the id and url in the run log. #510

Closed ELY3M closed 5 months ago

ELY3M commented 5 months ago

What happened?

my url and id do not save to my env as it should have. They are returning blank

- name: Upload Artifact
  uses: actions/upload-artifact@v4
  with:
    name: Release
    path: D:\a\Digital-Clock-in-sharpc\Digital-Clock-in-sharpc\Digital Clock\bin\Release\*
    retention-days: 1
  env: 
    GITHUB_TOKEN: ${{ github.token }} 
    MYID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
    MYURL: ${{ steps.artifact-upload-step.outputs.artifact-url }}

- name: Output MYURL
  run:  echo 'Artifact URL is ${{ env.MYURL }}'

- name: Output artifact URL test1
  run:  echo 'Artifact URL is ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}'

What did you expect to happen?

env.MYURL and env.MYURL should return string from upload.artifact

How can we reproduce it?

https://github.com/ELY3M/Digital-Clock-in-sharpc/actions/runs/7691645081/job/20957263725

my workflow is at https://github.com/ELY3M/Digital-Clock-in-sharpc/actions/runs/7691645081/workflow

Anything else we need to know?

No response

What version of the action are you using?

v4

What are your runner environments?

window

Are you on GitHub Enterprise Server? If so, what version?

No response

ELY3M commented 5 months ago

${{ steps.artifact-upload-step.outputs.artifact-id }} is returning blank too.
I am not sure why,

ELY3M commented 5 months ago

I figured out why!!!! I must have id: artifact-upload-step
I do not have id: artifact-upload-step

fixed and working

- name: Upload Artifact
  uses: actions/upload-artifact@v4
  id: artifact-upload-step
  with:
    name: Release
    path: D:\a\Digital-Clock-in-sharpc\Digital-Clock-in-sharpc\Digital Clock\bin\Release\*
    retention-days: 1
  env: 
    GITHUB_TOKEN: ${{ github.token }} 
    MYID: ${{ steps.artifact-upload-step.outputs.artifact-id }}
    MYURL: ${{ steps.artifact-upload-step.outputs.artifact-url }}

- name: Output MYURL
  run:  echo 'Artifact URL is ${{ env.MYURL }}'

- name: Output artifact URL test1
  run:  echo 'Artifact URL is ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}'
ELY3M commented 5 months ago

I am closing this issue.