Skip to content
Latchkey

How to Download an Artifact Into a Deploy Workflow in GitHub Actions

download-artifact with a run-id and github-token pulls a build from a different workflow run.

In the deploy workflow, call actions/download-artifact with run-id, the producing repo, and a token so it fetches the artifact from the CI run instead of the current one.

Steps

  • Trigger the deploy via workflow_run or workflow_dispatch.
  • Call download-artifact with run-id and github-token.
  • Deploy the restored files.

Workflow

.github/workflows/deploy.yml
on:
  workflow_run:
    workflows: [CI]
    types: [completed]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: dist
          path: dist/
          run-id: ${{ github.event.workflow_run.id }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - run: ./deploy.sh dist/

Gotchas

  • Cross-run downloads require both run-id and github-token; omitting the token returns not found.
  • The token needs actions: read to list artifacts from the other run.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →