From c7dcf0a98b1782ac38e9a2278fe18cc8f18c8792 Mon Sep 17 00:00:00 2001 From: Satya Rohith Date: Wed, 16 Jun 2021 05:31:38 +0530 Subject: [PATCH] fix: add install root to path --- .github/workflows/test.yml | 5 +++++ src/install.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91e4fd9..b179685 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,11 @@ jobs: - name: Test Deno run: deno run https://deno.land/std/examples/welcome.ts + - name: Test `deno install` + run: | + deno install --allow-net -n deno_curl https://deno.land/std/examples/curl.ts + deno_curl https://deno.land/std/examples/curl.ts + - name: Format if: runner.os == 'Linux' && matrix.deno == 'canary' run: npm run fmt:check diff --git a/src/install.js b/src/install.js index 2b027bf..51436be 100644 --- a/src/install.js +++ b/src/install.js @@ -1,3 +1,5 @@ +const os = require("os"); +const path = require("path"); const process = require("process"); const core = require("@actions/core"); const tc = require("@actions/tool-cache"); @@ -31,8 +33,11 @@ async function install(version) { "deno", version.isCanary ? `0.0.0-${version.version}` : version.version, ); - core.info(`Cached Deno to ${newCachedPath}.`); core.addPath(newCachedPath); + core.info(`Cached Deno to ${newCachedPath}.`); + const denoInstallRoot = process.env.DENO_INSTALL_ROOT || + path.join(os.homedir(), ".deno", "bin"); + core.addPath(denoInstallRoot); } /** @returns {string} */