mirror of
https://github.com/webfactory/ssh-agent.git
synced 2025-04-23 22:50:47 +00:00
[BUGFIX] Resolve gitPath
for git executable
Signed-off-by: Oktawian Chojnacki <oktawian@me.com>
This commit is contained in:
parent
26e485b72d
commit
0a5d1715cf
2 changed files with 8 additions and 7 deletions
8
index.js
8
index.js
|
@ -2,7 +2,7 @@ const core = require('@actions/core');
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const { home, sshAgent, sshAdd } = require('./paths.js');
|
const { home, sshAgent, sshAdd, gitPath } = require('./paths.js');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const privateKey = core.getInput('ssh-private-key');
|
const privateKey = core.getInput('ssh-private-key');
|
||||||
|
@ -64,9 +64,9 @@ try {
|
||||||
|
|
||||||
fs.writeFileSync(`${homeSsh}/key-${sha256}`, key + "\n", { mode: '600' });
|
fs.writeFileSync(`${homeSsh}/key-${sha256}`, key + "\n", { mode: '600' });
|
||||||
|
|
||||||
child_process.execSync(`git config --global --replace-all url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "https://github.com/${ownerAndRepo}"`);
|
child_process.execSync(`${gitPath} config --global --replace-all url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "https://github.com/${ownerAndRepo}"`);
|
||||||
child_process.execSync(`git config --global --add url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
child_process.execSync(`${gitPath} config --global --add url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
||||||
child_process.execSync(`git config --global --add url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
child_process.execSync(`${gitPath} config --global --add url."git@key-${sha256}.github.com:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
||||||
|
|
||||||
const sshConfig = `\nHost key-${sha256}.github.com\n`
|
const sshConfig = `\nHost key-${sha256}.github.com\n`
|
||||||
+ ` HostName github.com\n`
|
+ ` HostName github.com\n`
|
||||||
|
|
7
paths.js
7
paths.js
|
@ -6,13 +6,14 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
|
||||||
// Action runs, where $HOME is different from the pwent
|
// Action runs, where $HOME is different from the pwent
|
||||||
home: os.userInfo().homedir,
|
home: os.userInfo().homedir,
|
||||||
sshAgent: 'ssh-agent',
|
sshAgent: 'ssh-agent',
|
||||||
sshAdd: 'ssh-add'
|
sshAdd: 'ssh-add',
|
||||||
|
gitPath: 'git'
|
||||||
|
|
||||||
} : {
|
} : {
|
||||||
|
|
||||||
home: os.homedir(),
|
home: os.homedir(),
|
||||||
sshAgent: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
sshAgent: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
||||||
sshAdd: 'c://progra~1//git//usr//bin//ssh-add.exe'
|
sshAdd: 'c://progra~1//git//usr//bin//ssh-add.exe',
|
||||||
|
gitPath: 'c://progra~1//git//usr//bin//git.exe'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue