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
⚙ 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 totrue
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 totrue
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 totrue
to ignore forks, orfalse
to include them. For example:
allow_forks: false