1 name: Unprivileged Download Artifact
3 Download artifacts from another workflow run without using an access token.
7 The run-id for the workflow run that you want to download the artifact
8 from. If ommitted it will download the most recently created artifact
9 from the repo with the artifact-name.
12 desciption: The name of the artifact to download.
19 The filename of the downloaded artifact or the empty string if the
20 artifact was not found.
21 value: ${{ steps.download-artifact.outputs.filename }}
23 description: "The id of the artifact being downloaded."
24 value: ${{ steps.artifact-url.outputs.id }}
30 - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
35 if (!"${{ inputs.run-id }}") {
36 response = await github.rest.actions.listArtifactsForRepo({
37 owner: context.repo.owner,
38 repo: context.repo.repo,
39 name: "${{ inputs.artifact-name }}"
42 response = await github.rest.actions.listWorkflowRunArtifacts({
43 owner: context.repo.owner,
44 repo: context.repo.repo,
45 run_id: "${{ inputs.run-id }}",
46 name: "${{ inputs.artifact-name }}"
52 for (artifact of response.data.artifacts) {
53 console.log(artifact);
56 if (response.data.artifacts.length == 0) {
57 console.log("Could not find artifact ${{ inputs.artifact-name }} for workflow run ${{ inputs.run-id }}")
61 const url_response = await github.rest.actions.downloadArtifact({
62 owner: context.repo.owner,
63 repo: context.repo.repo,
64 artifact_id: response.data.artifacts[0].id,
68 core.setOutput("url", url_response.url);
69 core.setOutput("id", response.data.artifacts[0].id);
72 if: steps.artifact-url.outputs.url != ''
75 curl -L -o ${{ inputs.artifact-name }}.zip "${{ steps.artifact-url.outputs.url }}"
76 echo "filename=${{ inputs.artifact-name }}.zip" >> $GITHUB_OUTPUT
79 if: steps.download-artifact.outputs.filename != ''
81 unzip ${{ steps.download-artifact.outputs.filename }}