How to download artifacts from other (private) repo?

Viewed 579

I have private repo A (which is a library) and that repo has releases. Now I have repo B which has a dependency on the artifacts of A. The dependency (i.e. which version) is stored in a json file in B. What I'm looking for is a way to download the artifacts of release X from repo A in an action/workflow in repo B.

I have seen a lengthy bash script which make this possible, but I'm wondering if there are off the shelf actions around.

1 Answers

If you are using a Linux runner, you can use the Fetch Github Release Asset action.

uses: dsaltares/fetch-gh-release-asset@master
with:
  repo: "user/repo"
  version: "tags/v1"
  file: "filename.ext"
  target: "targetFolder/targetFileName.ext"
  token: ${{ secrets.PAT_TO_ACCESS_PRIVATE_REPO }}

Inputs

token

Required The GitHub token. Typically this will be ${{ secrets.GITHUB_TOKEN }}

file

Required The name of the file to be downloaded.

repo

The org/repo containing the release. Defaults to the current repo.

version

The release version to fetch from in the form tags/<tag_name> or <release_id>. Defaults to latest.

target

Target file path. Only supports paths to subdirectories of the GitHub Actions workspace directory

Related