fix: fix the git installation path on Windows

This commit is contained in:
Amin Yahyaabadi 2025-03-08 19:21:10 -08:00
parent 43327b967b
commit ae8148bb39
6 changed files with 13 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,6 @@
import { getInput } from "@actions/core"
import { info } from "ci-log"
import type { AddPathOptions } from "envosman"
import mri from "mri"
import { untildifyUser } from "untildify-user"
import { type Inputs, inputs } from "./tool.js"
@ -88,7 +89,7 @@ export function getSuccessMessage(tool: string, installationInfo: InstallationIn
return msg
}
export const rcOptions = {
export const rcOptions: AddPathOptions = {
rcPath: untildifyUser("~/.cpprc"),
guard: "cpp",
}

View File

@ -1,5 +1,7 @@
import { addPath } from "envosman"
import { installAptPack } from "setup-apt"
import { installBrewPack } from "setup-brew"
import { rcOptions } from "../cli-options.js"
import { hasDnf } from "../utils/env/hasDnf.js"
import { isArch } from "../utils/env/isArch.js"
import { isUbuntu } from "../utils/env/isUbuntu.js"
@ -8,10 +10,13 @@ import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupGit(version: string, _setupDir: string, _arch: string) {
export async function setupGit(version: string, _setupDir: string, _arch: string) {
switch (process.platform) {
case "win32": {
return setupChocoPack("git", version)
const result = await setupChocoPack("git", version)
result.binDir = "C:/Program Files (x86)/Git/bin"
await addPath(result.binDir, rcOptions)
return result
}
case "darwin": {
return installBrewPack("git", version)