How to Download an Artifact From a Different Workflow Run in GitHub Actions
actions/download-artifact only sees the current run by default, so pulling output from a separate workflow needs the run id and a token.
Point download-artifact at the source run with run-id and github-token, after locating the run id via the API or a triggering event.
Steps
- Identify the source workflow run id, often from the triggering event payload.
- Call actions/download-artifact with run-id and github-token set.
- Grant the job actions: read permission so it can list artifacts on another run.
- Use the artifact name to fetch only the file set you need.
Workflow
.github/workflows/consume-artifact.yml
name: Consume Artifact
on:
workflow_run:
workflows: ['Build']
types: [completed]
permissions:
actions: read
contents: read
jobs:
use:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: dist
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: ls -laNotes
- Without actions: read permission the cross-run download returns 403.
- Latchkey managed runners chain these dependent workflows cheaper and self-heal between stages.
Related guides
How to Pass Artifacts to a Deploy Workflow in GitHub ActionsHand a build artifact from one GitHub Actions workflow to a separate deploy workflow by downloading it via th…
How to Run a Job After Another Workflow Completes in GitHub ActionsTrigger a GitHub Actions workflow after another workflow finishes using workflow_run, gating on the upstream…