download-artifact icon indicating copy to clipboard operation
download-artifact copied to clipboard

[bug] Downloading artifact from previous run (specifying its `run-id`) does not work

Open weinshec opened this issue 1 year ago • 10 comments

What happened?

When specifying a run-id parameter to download an artifact from a previous workflow run (within the same repository) downloads the corresponding artifact of the current run, not the specified one (see screenshot)

image

What did you expect to happen?

The artifact from the specified run-id is being retrieved

How can we reproduce it?

Use the action twice. First time with a specific run-id, the second time with the defaulted current run-id, e.g.

      - name: Download latest main artifact
        uses: actions/download-artifact@v4
        with:
          name: build-artifacts
          path: base-build-artifacts
          run-id: <previous run id>

      - name: Download current PR artifacts
        uses: actions/download-artifact@v4
        with:
          name: build-artifacts
          path: new-build-artifacts

Anything else we need to know?

No response

What version of the action are you using?

v4

What are your runner environments?

linux

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

No response

weinshec avatar Feb 13 '24 11:02 weinshec

@weinshec Not a member of the download-artifact team, but I'm a bit confused: the IDs you marked in your screenshot are the workflow run ID and the artifact ID, respectively. Did you mean to say the IDs should be the same?

croemheld avatar Feb 17 '24 11:02 croemheld

@croemheld, sorry for the confusion. Let me try to elaborate...

What the screenshot shows are 2 (consecutive) steps in my workflow that each attempt to download a (different) artifact

  • The first one (titled: "Download latest main artifact") tries to download an artifact from the last time this workflow ran for a push-to-main event, hence I specify a concrete run-id from which the artifact should be downloaded (7840389011).
     - name: Download latest main artifact
       uses: actions/download-artifact@v4
        with:
          name: build-artifacts
          path: base-build-artifacts
          run-id: 7840389011
    
  • The second step (titled: "Download current PR artifact") tries to download an artifact from the current run (7885661760), hence using the default run-id
     - name: Download current PR artifacts
       uses: actions/download-artifact@v4
        with:
          name: build-artifacts
          path: base-build-artifacts
          # no run-id specified here (defaults to current: 7885661760)
    

As a result, I expect both steps to download a different artifact (one from run 7840389011 and one from run 7885661760), but instead both steps seem to resolve the same artifact to download (artifact IDs are the same)

weinshec avatar Feb 17 '24 22:02 weinshec

I can also confirm that run-id seems to be ignored.

ielashi avatar Mar 21 '24 14:03 ielashi

surprised that artifact-id isn't an input parameter. but also can confirm it is broken.

##[debug][Request] ListArtifacts https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts
##[debug][Response] - 200
##[debug]Headers: {
##[debug]  "content-length": "16",
##[debug]  "content-type": "application/json",
##[debug]Body: {
##[debug]  "artifacts": []
##[debug]}

StephenHodgson avatar Mar 22 '24 19:03 StephenHodgson

Ok i have this bug =/

Same the run-id doesn't work

Horsty80 avatar Apr 06 '24 00:04 Horsty80

I am fairly sure the fix is that you have to specify the github-token option whenever you specify the run-id of another run

harry-unlikelyai avatar Apr 11 '24 16:04 harry-unlikelyai

I am fairly sure the fix is that you have to specify the github-token option whenever you specify the run-id of another run

Even so, it should not silently fail

StephenHodgson avatar Apr 11 '24 19:04 StephenHodgson