actions / download-artifact

MIT License
1.44k stars 498 forks source link

[feat req] support output(s) of actions/upload-artifact as input #334

Open weilbith opened 5 months ago

weilbith commented 5 months ago

What would you like to be added?

Hey :wave:

I would like to better connect two jobs/steps of actions/upload-artifact and actions/download-artifact. Therefore, it would be very useful if the outputs of the former could be used as input for the latter. At the moment I see no correlation between the documented outputs and the inputs. So currently I have to copy paste the name, if that even works. This might be okayish for jobs where the code is close together. So correlation can be verifed by eye. But it would be great to create a strong connection that could be even verified by actionslint (by verifying a correct output is used).

Taking the artifact-id as an example. A exemplary workflow with two jobs (could be also just two steps within a job) could then look like this. This also includes the "hints" how to do it now (?).

# Trigger & Co.

jobs:
  job1:
    runs-on: ubuntu-latest
    outputs:
      artifact-id: ${{ steps.upload.outputs.artifact-id }}

    steps:
      - name: do something that can be uploaded then
        run: echo foo > bar.txt

      - uses: actions/upload-artifact@v4
        id: upload
        with:
          path: ./bar.txt
          name: important-asset # simple static name for linking

  job2:
    needs: job1
    steps:
      - uses: actions/download-artifact@v4
        with:
          artifact-id: ${{ needs.job1.outputs.artifact-id }}
          # how to do it now --> name: important-asset
          path: ./can-be-found-here

      - name: do something with the downloaded asset
        run: stat ./can-be-found-here

Why is this needed?

Strong, verifiable, auto-completable relationship between these two related actions. Potentially supporting more complex scenarios where simple copy-code names do not work.

L-RAE269 commented 2 months ago

b54d0883e196647f43ce531a3fc13b246cf908b6

weilbith commented 2 months ago

@L-RAE269 thanks for the response. I must admit that I fail to parse the code in terms of a new input variable. I also can't find something in the latest docs. Would you mind giving me a hint? 😃