1
- import * as fs from "node:fs/promises" ;
2
- import * as os from "node:os" ;
3
- import * as path from "node:path" ;
4
1
import * as core from "@actions/core" ;
5
2
import { exec } from "@actions/exec" ;
6
3
import { HttpClient } from "@actions/http-client" ;
@@ -9,8 +6,8 @@ import * as toolCache from "@actions/tool-cache";
9
6
import * as cheerio from "cheerio" ;
10
7
import * as semver from "semver" ;
11
8
import {
9
+ CYGWIN_LOCAL_PACKAGE_DIR ,
12
10
CYGWIN_MIRROR ,
13
- CYGWIN_MIRROR_ENCODED_URI ,
14
11
CYGWIN_ROOT ,
15
12
} from "./constants.js" ;
16
13
@@ -37,40 +34,8 @@ export const cygwinVersion = (async () => {
37
34
return version ;
38
35
} ) ( ) ;
39
36
40
- async function setGitToIgnoreCygwinLocalPackageDirectory ( ) {
41
- const xdgConfigHome = process . env . XDG_CONFIG_HOME ;
42
- const homeDir = os . homedir ( ) ;
43
- const globalGitConfigDir = xdgConfigHome
44
- ? path . join ( xdgConfigHome , "git" )
45
- : path . join ( homeDir , ".config" , "git" ) ;
46
- await fs . mkdir ( globalGitConfigDir , { recursive : true } ) ;
47
- const globalGitIgnorePath = path . join ( globalGitConfigDir , "ignore" ) ;
48
- try {
49
- await fs . access ( globalGitIgnorePath , fs . constants . R_OK ) ;
50
- const contents = await fs . readFile ( globalGitIgnorePath , {
51
- encoding : "utf8" ,
52
- } ) ;
53
- if ( ! contents . includes ( CYGWIN_MIRROR_ENCODED_URI ) ) {
54
- await fs . appendFile ( globalGitIgnorePath , CYGWIN_MIRROR_ENCODED_URI , {
55
- encoding : "utf8" ,
56
- } ) ;
57
- }
58
- } catch {
59
- await fs . writeFile ( globalGitIgnorePath , CYGWIN_MIRROR_ENCODED_URI , {
60
- encoding : "utf8" ,
61
- } ) ;
62
- } finally {
63
- await exec (
64
- "git" ,
65
- [ "config" , "--add" , "--global" , "core.excludesfile" , globalGitIgnorePath ] ,
66
- { windowsVerbatimArguments : true } ,
67
- ) ;
68
- }
69
- }
70
-
71
37
export async function setupCygwin ( ) {
72
38
await core . group ( "Setting up Cygwin environment" , async ( ) => {
73
- await setGitToIgnoreCygwinLocalPackageDirectory ( ) ;
74
39
const version = await cygwinVersion ;
75
40
const cachedPath = toolCache . find ( "cygwin" , version , "x86_64" ) ;
76
41
if ( cachedPath === "" ) {
@@ -106,6 +71,7 @@ export async function setupCygwin() {
106
71
"--quiet-mode" ,
107
72
"--symlink-type=sys" ,
108
73
"--upgrade-also" ,
74
+ `--local-package-dir=${ CYGWIN_LOCAL_PACKAGE_DIR } ` ,
109
75
`--packages=${ packages } ` ,
110
76
`--root=${ CYGWIN_ROOT } ` ,
111
77
`--site=${ CYGWIN_MIRROR } ` ,
0 commit comments