@@ -322,7 +322,7 @@ const core = __webpack_require__(470);
322
322
const child_process = __webpack_require__ ( 129 ) ;
323
323
const fs = __webpack_require__ ( 747 ) ;
324
324
const crypto = __webpack_require__ ( 417 ) ;
325
- const { home , sshAgent , sshAdd } = __webpack_require__ ( 972 ) ;
325
+ const { homePath , sshAgentCmd , sshAddCmd , gitCmd } = __webpack_require__ ( 972 ) ;
326
326
327
327
try {
328
328
const privateKey = core . getInput ( 'ssh-private-key' ) ;
@@ -334,7 +334,7 @@ try {
334
334
return ;
335
335
}
336
336
337
- const homeSsh = home + '/.ssh' ;
337
+ const homeSsh = homePath + '/.ssh' ;
338
338
339
339
console . log ( `Adding GitHub.com keys to ${ homeSsh } /known_hosts` ) ;
340
340
@@ -349,7 +349,7 @@ try {
349
349
const sshAgentArgs = ( authSock && authSock . length > 0 ) ? [ '-a' , authSock ] : [ ] ;
350
350
351
351
// Extract auth socket path and agent pid and set them as job variables
352
- child_process . execFileSync ( sshAgent , sshAgentArgs ) . toString ( ) . split ( "\n" ) . forEach ( function ( line ) {
352
+ child_process . execFileSync ( sshAgentCmd , sshAgentArgs ) . toString ( ) . split ( "\n" ) . forEach ( function ( line ) {
353
353
const matches = / ^ ( S S H _ A U T H _ S O C K | S S H _ A G E N T _ P I D ) = ( .* ) ; e x p o r t \1/ . exec ( line ) ;
354
354
355
355
if ( matches && matches . length > 0 ) {
@@ -362,16 +362,16 @@ try {
362
362
console . log ( "Adding private key(s) to agent" ) ;
363
363
364
364
privateKey . split ( / (? = - - - - - B E G I N ) / ) . forEach ( function ( key ) {
365
- child_process . execFileSync ( sshAdd , [ '-' ] , { input : key . trim ( ) + "\n" } ) ;
365
+ child_process . execFileSync ( sshAddCmd , [ '-' ] , { input : key . trim ( ) + "\n" } ) ;
366
366
} ) ;
367
367
368
368
console . log ( "Key(s) added:" ) ;
369
369
370
- child_process . execFileSync ( sshAdd , [ '-l' ] , { stdio : 'inherit' } ) ;
370
+ child_process . execFileSync ( sshAddCmd , [ '-l' ] , { stdio : 'inherit' } ) ;
371
371
372
372
console . log ( 'Configuring deployment key(s)' ) ;
373
373
374
- child_process . execFileSync ( sshAdd , [ '-L' ] ) . toString ( ) . split ( / \r ? \n / ) . forEach ( function ( key ) {
374
+ child_process . execFileSync ( sshAddCmd , [ '-L' ] ) . toString ( ) . split ( / \r ? \n / ) . forEach ( function ( key ) {
375
375
const parts = key . match ( / \b g i t h u b \. c o m [: / ] ( [ _ . a - z 0 - 9 - ] + \/ [ _ . a - z 0 - 9 - ] + ) / i) ;
376
376
377
377
if ( ! parts ) {
@@ -386,9 +386,9 @@ try {
386
386
387
387
fs . writeFileSync ( `${ homeSsh } /key-${ sha256 } ` , key + "\n" , { mode : '600' } ) ;
388
388
389
- child_process . execSync ( `git config --global --replace-all url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "https://github.com/${ ownerAndRepo } "` ) ;
390
- child_process . execSync ( `git config --global --add url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "[email protected] :${ ownerAndRepo } "` ) ;
391
- child_process . execSync ( `git config --global --add url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "ssh://[email protected] /${ ownerAndRepo } "` ) ;
389
+ child_process . execSync ( `${ gitCmd } config --global --replace-all url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "https://github.com/${ ownerAndRepo } "` ) ;
390
+ child_process . execSync ( `${ gitCmd } config --global --add url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "[email protected] :${ ownerAndRepo } "` ) ;
391
+ child_process . execSync ( `${ gitCmd } config --global --add url."git@key-${ sha256 } .github.com:${ ownerAndRepo } ".insteadOf "ssh://[email protected] /${ ownerAndRepo } "` ) ;
392
392
393
393
const sshConfig = `\nHost key-${ sha256 } .github.com\n`
394
394
+ ` HostName github.com\n`
@@ -2903,23 +2903,21 @@ exports.default = _default;
2903
2903
const os = __webpack_require__ ( 87 ) ;
2904
2904
2905
2905
module . exports = ( process . env [ 'OS' ] != 'Windows_NT' ) ? {
2906
-
2907
2906
// Use getent() system call, since this is what ssh does; makes a difference in Docker-based
2908
2907
// Action runs, where $HOME is different from the pwent
2909
- home : os . userInfo ( ) . homedir ,
2910
- sshAgent : 'ssh-agent' ,
2911
- sshAdd : 'ssh-add'
2912
-
2908
+ homePath : os . userInfo ( ) . homedir ,
2909
+ sshAgentCmd : 'ssh-agent' ,
2910
+ sshAddCmd : 'ssh-add' ,
2911
+ gitCmd : 'git'
2913
2912
} : {
2914
-
2915
- home : os . homedir ( ) ,
2916
- sshAgent : 'c://progra~1//git//usr//bin//ssh-agent.exe' ,
2917
- sshAdd : 'c://progra~1//git//usr//bin//ssh-add.exe'
2918
-
2913
+ // Assuming GitHub hosted `windows-*` runners for now
2914
+ homePath : os . homedir ( ) ,
2915
+ sshAgentCmd : 'c://progra~1//git//usr//bin//ssh-agent.exe' ,
2916
+ sshAddCmd : 'c://progra~1//git//usr//bin//ssh-add.exe' ,
2917
+ gitCmd : 'c://progra~1//git//usr//bin//git.exe'
2919
2918
} ;
2920
2919
2921
2920
2922
-
2923
2921
/***/ } )
2924
2922
2925
2923
/******/ } ) ;
0 commit comments