From a19fcfecdfde640562873027e8fe5dbb5412ac2e Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 28 Feb 2022 21:51:52 -0800 Subject: [PATCH] refactor: use untildify_user in addEnv --- src/utils/env/addEnv.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/utils/env/addEnv.ts b/src/utils/env/addEnv.ts index 32102d57..7151a538 100644 --- a/src/utils/env/addEnv.ts +++ b/src/utils/env/addEnv.ts @@ -3,8 +3,6 @@ import * as core from "@actions/core" import { isGitHubCI } from "./isci" import { untildify_user as untildify } from "../path/untildify" import { appendFileSync } from "fs" -import { join } from "path" -import { isRoot } from "./sudo" import { error } from "../io/io" import { execPowershell } from "../exec/powershell" @@ -39,12 +37,7 @@ function addEnvSystem(name: string, valGiven: string | undefined) { case "linux": case "darwin": { // find profile path - let profile_path = untildify(".profile") - if (isRoot() && typeof process.env.SUDO_USER === "string") { - // use the user profile even if root - profile_path = join("/home/", process.env.SUDO_USER, ".profile") - } - + const profile_path = untildify(".profile") appendFileSync(profile_path, `\nexport ${name}="${val}"\n`) core.info(`${name}="${val} was added to "${profile_path}"`) return