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

How to Download workflow artifact GitHub Action?

dawidd6/action-download-artifact -
GitHub Action
v3.1.4
713
Contributors
Contributor - dawidd6
Categories

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: Download Artifact Example

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
download-artifact:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: Build
name: build-artifact
path: ./artifacts

action-download-artifact logo

action-download-artifact

A GitHub Action to download an artifact associated with given workflow and commit or other criteria


This action will aid you in downloading a file (artifact) created and uploaded by a different workflow.

This is useful for taking advantage of files created in one workflow within another workflow. It can be beneficial for continuous integration/deployment processes where you need the test results, build output, or some other type of file to use in the next step. Such action use makes a modular and reusable workflow. Sharing of data and tasks across different workflows may be harvested by downloading artifacts, which helps overall efficiency and flexibility in the process.

Tabii, her bir "how to" başlığı için bu GitHub Action özelinde açıklamalar aşağıda verilmiştir:

How to treat the artifact name as a regular expression?

  • Set the name_is_regexp input to true to treat the artifact name as a regular expression. For example:
name_is_regexp: true

How to define the directory where artifacts are extracted?

  • Use the path input to specify the directory where the artifacts should be extracted. For example:
path: extract_here

How to specify the repository for downloading artifacts?

  • The repo input allows you to specify the repository from which to download the artifacts. For example:
repo: ${{ github.repository }}

How to check if a workflow run has an artifact?

  • Use the check_artifacts input to check if the workflow run has an artifact before attempting to download it. For example:
check_artifacts: false

How to search for the last workflow run with a specific artifact name?

  • Set the search_artifacts input to true to search for the last workflow run with a specific artifact name. For example:
search_artifacts: false

How to skip unpacking the downloaded artifacts?

  • Use the skip_unpack input to choose whether to skip unpacking the downloaded artifacts. For example:
skip_unpack: false

How to handle situations where no artifact is found?

  • Specify the action to take if no artifact is found using the if_no_artifact_found input. It can be set to "fail", "warn", or "ignore". For example:
if_no_artifact_found: fail

How to ignore forks when searching for artifacts?

  • Use the allow_forks input to specify whether to ignore forks when searching for artifacts. Set it to true to ignore forks, or false to include them. For example:
allow_forks: false