Skip to content
hard-drive

GitHub Action

Download latest artifact from a github workflow

v2.2 Latest version

Download latest artifact from a github workflow

hard-drive

Download latest artifact from a github workflow

Download the latest artifact from a successful github workflow (aka. build) for a given branch

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Download latest artifact from a github workflow

uses: benday-inc/[email protected]

Learn more about this action in benday-inc/download-latest-artifact

Choose a version

build-test

Download an artifact from a github workflow

This action helps you to download an artifact from another github workflow. The out-of-the-box download artifact action from github only allows you to download artifacts from a job in the current workflow. This action gets around this restriction. The workflow can even be hosted in another github account.

The action downloads the latest artifact from the last successful workflow run executed against the provided branch. Failed workflow runs are ignored. Workflow runs against branches other than the supplied branch are ignored.

NOTE: if you want to download the artifact from a specific pipeline run instance (run id), use the Download artifact from a github workflow run.

Usage

To download an artifact from a workflow:

- name: download workflow artifact
  uses: benday-inc/download-latest-artifact@main
  with:
     token: ${{ secrets.TOKEN_WITH_PERMISSIONS }}'
     repository_owner: 'benday'
     repository_name: 'actionsdemo'
     workflow_name: 'my-workflow'
     branch_name: 'master'
     artifact_name: 'build-output'
     download_path: '${{ github.workspace }}/temp'
     download_filename: 'actionsdemo-artifact.zip'

Action Spec:

Environment variables

  • None

Inputs

  • token - github token for the target repository
  • repository_owner - name of the repository account owner
  • repository_name - name of the repository
  • workflow_name - name of the workflow that created the artifact
  • branch_name - name of the branch that the workflow should run off of
  • artifact_name - name of artifact to download
  • download_path - location on the agent to download the artifact to.
  • download_filename - download the artifact file as this filename

Outputs

  • None