diff --git a/dist/cleanup.js b/dist/cleanup.js index 8af40c8..b3dc713 100644 --- a/dist/cleanup.js +++ b/dist/cleanup.js @@ -2835,7 +2835,8 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? { homePath: os.homedir(), sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe', sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe', - gitCmd: 'c://progra~1//git//bin//git.exe' + gitCmd: 'c://progra~1//git//bin//git.exe', + pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe' }; diff --git a/dist/index.js b/dist/index.js index 3039a0b..ad1f984 100644 --- a/dist/index.js +++ b/dist/index.js @@ -322,7 +322,7 @@ const core = __webpack_require__(470); const child_process = __webpack_require__(129); const fs = __webpack_require__(747); const crypto = __webpack_require__(417); -const { homePath, sshAgentCmd, sshAddCmd, gitCmd } = __webpack_require__(972); +const { homePath, sshAgentCmd, sshAddCmd, gitCmd, pathsCmd } = __webpack_require__(972); try { const privateKey = core.getInput('ssh-private-key'); @@ -353,6 +353,10 @@ try { const matches = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line); if (matches && matches.length > 0) { + // use pathsCmd to convert socket file to a windows path + if (pathsCmd && matches[1] === "SSH_AUTH_SOCK") { + matches[2] = child_process.execFileSync(pathsCmd, ['-m', matches[2]]).toString().trim() + } // This will also set process.env accordingly, so changes take effect for this script core.exportVariable(matches[1], matches[2]) console.log(`${matches[1]}=${matches[2]}`); @@ -2914,7 +2918,8 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? { homePath: os.homedir(), sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe', sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe', - gitCmd: 'c://progra~1//git//bin//git.exe' + gitCmd: 'c://progra~1//git//bin//git.exe', + pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe' }; diff --git a/index.js b/index.js index add5f7c..dc9331f 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const core = require('@actions/core'); const child_process = require('child_process'); const fs = require('fs'); const crypto = require('crypto'); -const { homePath, sshAgentCmd, sshAddCmd, gitCmd } = require('./paths.js'); +const { homePath, sshAgentCmd, sshAddCmd, gitCmd, pathsCmd } = require('./paths.js'); try { const privateKey = core.getInput('ssh-private-key'); @@ -33,6 +33,10 @@ try { const matches = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line); if (matches && matches.length > 0) { + // use pathsCmd to convert socket file to a windows path + if (pathsCmd && matches[1] === "SSH_AUTH_SOCK") { + matches[2] = child_process.execFileSync(pathsCmd, ['-m', matches[2]]).toString().trim() + } // This will also set process.env accordingly, so changes take effect for this script core.exportVariable(matches[1], matches[2]) console.log(`${matches[1]}=${matches[2]}`); diff --git a/paths.js b/paths.js index fa2c366..c1100ab 100644 --- a/paths.js +++ b/paths.js @@ -12,5 +12,6 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? { homePath: os.homedir(), sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe', sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe', - gitCmd: 'c://progra~1//git//bin//git.exe' + gitCmd: 'c://progra~1//git//bin//git.exe', + pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe' };