From e9ac7655360521a3fd250a932770c9ec043fe495 Mon Sep 17 00:00:00 2001 From: Frank Lim Date: Mon, 28 Aug 2023 02:51:05 +0000 Subject: [PATCH] feat: Add option for repository auth --- README.md | 1 + action.yml | 7 +++++++ src/index.js | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f12663..5403d04 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ jobs: | `cache` | No | `true` | Whether to cache RPC responses or not. | bool | | `version` | No | `nightly` | Version to install, e.g. `nightly` or `1.0.0`. **Note:** Foundry only has nightly builds for the time being. | string | | `repository` | No | `https://github.com` | Artifact repository url prefix to download Foundry binaries from. It needs to be compliant with Github's path. | string | +| `repository-auth` | No | `""` | HTTP Authorization header for the above repository. Not required for Github. | string | ### RPC Caching diff --git a/action.yml b/action.yml index 66d21b1..78671f6 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,13 @@ inputs: The repo artifact path has to conform to the url format of github, like `${repository}/foundry-rs/foundry/releases/download/${version}/${fullFileName}` The default value is `https://github.com`. required: false + repository-auth: + default: "" + description: | + HTTP Authorization header for the above repository. Not required for Github. + + Left empty by default. + required: false runs: using: "node16" diff --git a/src/index.js b/src/index.js index 51c80e5..813d784 100644 --- a/src/index.js +++ b/src/index.js @@ -11,11 +11,12 @@ async function main() { const version = core.getInput("version"); // Get artifact repository input const repository = core.getInput("repository"); + const repositoryAuth = core.getInput("repository-auth"); // Download the archive containing the binaries const download = getDownloadObject(repository, version); core.info(`Downloading Foundry '${version}' from: ${download.url}`); - const pathToArchive = await toolCache.downloadTool(download.url); + const pathToArchive = await toolCache.downloadTool(download.url, '', repositoryAuth); // Extract the archive onto host runner core.debug(`Extracting ${pathToArchive}`);