💸Save up to $132K/month in CI costs!👉 Try Free
Skip to main content
← Back to workflows

How to Download Artifacts in GitHub Actions?

actions-download-artifact -
GitHub Action
v4.1.7
1,397
Contributors
Contributor - robherleyContributor - konradpabjanContributor - vmjoseph

Optimize Your CI/CD Pipeline

Get instant insights into your CI/CD performance and costs. Reduce build times by up to 45% and save on infrastructure costs.

45% Faster Builds
60% Cost Reduction
Usage
name: 'Usage of download-artifact GitHub Action'
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R

download-artifact logo

Download Artifact

Automatically download all artifacts from a GitHub Actions workflow, each stored in its designated directory for organized access and management


What is download-artifact GitHub Action?

The @actions/download-artifact action is designed to simplify the process of downloading artifacts from completed workflow runs. This action is internally powered by the @actions/artifact package, ensuring robust and reliable artifact handling.

How to Download a Single Artifact to Specific Directories in GitHub Actions

Sometimes you may want to download an artifact to the default working directory or to a path you specify. This way, downloading the artifact using the GitHub Action @actions/download-artifact, here is how you would download an artifact to a location other than the default workspace location within a workflow.

steps:
- uses: actions/download-artifact@v4
with:
name: my-artifact
- name: Display structure of downloaded files
run: ls -R

Downloading an Artifact to a Specific Directory

If you need to download an artifact to a specific directory, you can specify the path where the artifact should be stored. This is useful for organizing downloads or preparing for subsequent steps that expect files in certain locations.

steps:
- uses: actions/download-artifact@v4
with:
name: my-artifact
path: your/destination/dir
- name: Display structure of downloaded files
run: ls -R your/destination/dir

How to Download All Artifacts

In scenarios where multiple artifacts are generated during a workflow, you may need to download all of them for further processing or analysis. GitHub Actions provides a straightforward method to handle this by using the @actions/download-artifact action. This guide will show you how to configure your workflow to download all artifacts and manage their storage efficiently.

steps:
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R