mirror of https://github.com/aminya/setup-cpp
feat: catch the addPath failure
This commit is contained in:
parent
87beee7e7d
commit
882d0f7013
|
@ -1,4 +1,4 @@
|
||||||
import { addPath } from "@actions/core"
|
import { addPath } from "../utils/path/addPath"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { addPath } from "@actions/core"
|
import { addPath } from "../utils/path/addPath"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { addPath, exportVariable, info } from "@actions/core"
|
import { exportVariable, info } from "@actions/core"
|
||||||
|
import { addPath } from "../utils/path/addPath"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { addPath } from "@actions/core"
|
import { addPath } from "../utils/path/addPath"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { addPath as ghAddPath } from "@actions/core"
|
||||||
|
import { delimiter } from "path"
|
||||||
|
import * as core from "@actions/core"
|
||||||
|
|
||||||
|
/** An add path function that works locally or inside GitHub Actions */
|
||||||
|
export function addPath(path: string) {
|
||||||
|
try {
|
||||||
|
ghAddPath(path)
|
||||||
|
} catch (err) {
|
||||||
|
core.error(err as Error)
|
||||||
|
core.error(`Failed to add ${path} to the percistent PATH. You should add it manually.`)
|
||||||
|
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
|
||||||
|
// TODO shell out to add path
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
|
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
|
||||||
import { addPath, info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
|
import { addPath } from "../path/addPath"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import * as hasha from "hasha"
|
import * as hasha from "hasha"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import { addPath } from "@actions/core"
|
import { addPath } from "../path/addPath"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
import { getExecOutput } from "@actions/exec"
|
import { getExecOutput } from "@actions/exec"
|
||||||
import spawn from "cross-spawn"
|
import spawn from "cross-spawn"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath, info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
|
import { addPath } from "../path/addPath"
|
||||||
import { setupPython } from "../../python/python"
|
import { setupPython } from "../../python/python"
|
||||||
import { isBinUptoDate } from "./version"
|
import { isBinUptoDate } from "./version"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
|
|
Loading…
Reference in New Issue