GitHub Actions Download an Artifact From a Different Workflow Run
An artifact uploaded by one workflow run is not found by a different run because actions/download-artifact defaults to the current run. To fetch across runs you must pass run-id and a github-token with access.
What this error means
A download-artifact step in a separate run (often a workflow_run-triggered one) fails to find the artifact, because it looked in the current run’s artifacts instead of the producing run’s.
- uses: actions/download-artifact@v4
with:
name: build-output
# Error: Unable to find any artifacts for the associated workflow runDiagnose it: was the cache hit, and was it the right one?
Cache bugs split into three shapes and they need different fixes: the cache never saved, it saved but the key never matches on restore, or it restored a stale entry through a restore-keys prefix and is now poisoning the build. The step output tells you which one you have.
- uses: actions/cache@v4
id: cache
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: What happened
run: |
echo "exact hit: ${{ steps.cache.outputs.cache-hit }}"
echo "key used: ${{ steps.cache.outputs.cache-matched-key }}"Common causes
Default scope is the current run
download-artifact looks at the current run’s artifacts unless told otherwise. An artifact from another run is not visible without run-id.
Missing run-id or token
Cross-run download needs the producing run’s id and a github-token with actions:read so the action can fetch it.
How to fix it
Pass run-id and a token
Provide the source run id (e.g. from the workflow_run event) and a token with read access.
- uses: actions/download-artifact@v4
with:
name: build-output
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
permissions:
actions: readConfirm the artifact and access
- Check the artifact still exists and has not passed its retention window.
- Grant actions: read so the token can list and download cross-run artifacts.
- For cross-repo downloads, use a token with access to the source repository.
Cache limits that produce confusing failures
- Repository cache is capped at 10 GB. Past that, GitHub evicts least-recently-used entries, so a large cache can silently stop persisting.
- Caches are scoped by branch. A cache written on a feature branch is not visible to another feature branch, only to its base and its own descendants.
- An entry not read for 7 days is evicted, so a rarely-run workflow effectively never has a warm cache.
- Restoring a cache built for a different tool version is worse than a cold start, because you get a corrupted tree instead of a clean install. Always include the tool version in the key.
How to prevent it
- Pass run-id and github-token when downloading across runs.
- Grant actions: read for cross-run artifact access.
- Mind artifact retention so the source artifact still exists.