diff --git a/dist/index.js b/dist/index.js index 212c3cc..429e9ad 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6643,7 +6643,8 @@ function run() { const name = core.getInput(constants_1.Inputs.Name, { required: false }); const path = core.getInput(constants_1.Inputs.Path, { required: false }); let resolvedPath; - if (path === '~' || path.startsWith(`~${path_1.sep}`)) { + // resolve tilde expansions, path.replace only replaces the first occurrence of a pattern + if (path.startsWith(`~`)) { resolvedPath = path_1.resolve(path.replace('~', os.homedir())); } else { diff --git a/src/download-artifact.ts b/src/download-artifact.ts index 5621fec..b32a7be 100644 --- a/src/download-artifact.ts +++ b/src/download-artifact.ts @@ -1,7 +1,7 @@ import * as core from '@actions/core' import * as artifact from '@actions/artifact' import * as os from 'os' -import {resolve, sep} from 'path' +import {resolve} from 'path' import {Inputs, Outputs} from './constants' async function run(): Promise { @@ -10,7 +10,8 @@ async function run(): Promise { const path = core.getInput(Inputs.Path, {required: false}) let resolvedPath - if (path === '~' || path.startsWith(`~${sep}`)) { + // resolve tilde expansions, path.replace only replaces the first occurrence of a pattern + if (path.startsWith(`~`)) { resolvedPath = resolve(path.replace('~', os.homedir())) } else { resolvedPath = resolve(path)