This commit is contained in:
Konrad Pabjan 2020-07-29 18:25:26 +02:00
parent 23faf7dc6f
commit 49b7a3bcdf
2 changed files with 5 additions and 3 deletions

3
dist/index.js vendored
View file

@ -6643,7 +6643,8 @@ function run() {
const name = core.getInput(constants_1.Inputs.Name, { required: false }); const name = core.getInput(constants_1.Inputs.Name, { required: false });
const path = core.getInput(constants_1.Inputs.Path, { required: false }); const path = core.getInput(constants_1.Inputs.Path, { required: false });
let resolvedPath; 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())); resolvedPath = path_1.resolve(path.replace('~', os.homedir()));
} }
else { else {

View file

@ -1,7 +1,7 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as artifact from '@actions/artifact' import * as artifact from '@actions/artifact'
import * as os from 'os' import * as os from 'os'
import {resolve, sep} from 'path' import {resolve} from 'path'
import {Inputs, Outputs} from './constants' import {Inputs, Outputs} from './constants'
async function run(): Promise<void> { async function run(): Promise<void> {
@ -10,7 +10,8 @@ async function run(): Promise<void> {
const path = core.getInput(Inputs.Path, {required: false}) const path = core.getInput(Inputs.Path, {required: false})
let resolvedPath 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())) resolvedPath = resolve(path.replace('~', os.homedir()))
} else { } else {
resolvedPath = resolve(path) resolvedPath = resolve(path)